py2ls 0.1.9.9__py3-none-any.whl → 0.1.10.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. py2ls/.git/COMMIT_EDITMSG +1 -1
  2. py2ls/.git/FETCH_HEAD +1 -1
  3. py2ls/.git/index +0 -0
  4. py2ls/.git/logs/HEAD +1 -0
  5. py2ls/.git/logs/refs/heads/main +1 -0
  6. py2ls/.git/logs/refs/remotes/origin/HEAD +1 -0
  7. py2ls/.git/logs/refs/remotes/origin/main +1 -0
  8. py2ls/.git/objects/27/aa6074f652bc6f7078f8647489d9ee8e24f0e2 +0 -0
  9. py2ls/.git/objects/28/c2969d785c1b892c2a96b3f00eba63a59811b3 +0 -0
  10. py2ls/.git/objects/2a/fdf45791a26d42ccead35ace76a8f0b2a56561 +0 -0
  11. py2ls/.git/objects/34/b6f3a2ee84f39bed4eee57f2c0e0afb994feb1 +0 -0
  12. py2ls/.git/objects/35/1a5f491ab97eee9d1ee699478d75a8bb5d3dc2 +0 -0
  13. py2ls/.git/objects/39/b13be65125556784e44c7a1d9821703c7ab67e +0 -0
  14. py2ls/.git/objects/3b/507acc7f23391644cc0b824b1e79fd2677a362 +0 -0
  15. py2ls/.git/objects/3d/9d10d27724657a436c65a6254bfd213d4b3562 +0 -0
  16. py2ls/.git/objects/47/6cbd5a7c5e35cddef2f8a38bdc4896d403b095 +0 -0
  17. py2ls/.git/objects/78/063f4c863fc371ec0313303c0a81283b35d9b6 +0 -0
  18. py2ls/.git/objects/82/70b319ce4046854fbe7dc41054b6c2d112dab2 +0 -0
  19. py2ls/.git/objects/85/aee46f478e9afdb84d50a05242c53b04ed2e21 +0 -0
  20. py2ls/.git/objects/86/e288b46f8fe179907e4413f665aeb5053fddb1 +0 -0
  21. py2ls/.git/objects/94/f7dbe88e80c4205a901b71eb8f181974376bba +0 -0
  22. py2ls/.git/objects/9b/ec5ee2236ee2d5532c36bfd132e23c58fdb69c +0 -0
  23. py2ls/.git/objects/b3/4f7f271c6d6105e35a6556ffda71d03afe8c96 +0 -0
  24. py2ls/.git/objects/b3/69579064bde9de9a19d114fc33e4e48cc8c0e4 +0 -0
  25. py2ls/.git/objects/bf/b54d65922ce1dfda1aaa014913a54e7172d0bc +0 -0
  26. py2ls/.git/objects/c1/397c6ed72c4e20ef6b9ab83163e9a6baba5b45 +0 -0
  27. py2ls/.git/objects/cc/45df1d317a2eb63ff1ff3a5f3b4a9f98fd92b5 +0 -0
  28. py2ls/.git/objects/d6/39e8af592cd75a318d8affddd1bcc70c2095f2 +0 -0
  29. py2ls/.git/objects/db/3f2cd643292057936230b95cf7ec3046affe11 +0 -0
  30. py2ls/.git/objects/de/214c626ac2dd2685bfaa0bc0fc20f528d014d7 +0 -0
  31. py2ls/.git/objects/e4/6c715352db9fe3c887a635f1916df4ca1f4ff9 +0 -0
  32. py2ls/.git/objects/e5/0580a0bd1e1b3d29f834382b80fceb61d5cf0c +0 -0
  33. py2ls/.git/objects/ec/d980279432b13f0374b90ca439a6329cdece0f +0 -0
  34. py2ls/.git/objects/ee/cee64eacaff022dcdc509c0c2b1da492f21060 +0 -0
  35. py2ls/.git/objects/f5/61c3c1bf1c9ea9c9d1f556a7be2869f71f3bdf +0 -0
  36. py2ls/.git/refs/heads/main +1 -1
  37. py2ls/.git/refs/remotes/origin/main +1 -1
  38. py2ls/batman.py +198 -0
  39. py2ls/ich2ls.py +539 -85
  40. py2ls/ips.py +1 -1
  41. py2ls/netfinder.py +105 -3
  42. py2ls/ocr.py +557 -0
  43. py2ls/plot.py +68 -11
  44. {py2ls-0.1.9.9.dist-info → py2ls-0.1.10.1.dist-info}/METADATA +1 -1
  45. {py2ls-0.1.9.9.dist-info → py2ls-0.1.10.1.dist-info}/RECORD +46 -16
  46. {py2ls-0.1.9.9.dist-info → py2ls-0.1.10.1.dist-info}/WHEEL +0 -0
py2ls/.git/COMMIT_EDITMSG CHANGED
@@ -1 +1 @@
1
- update
1
+ reg_update
py2ls/.git/FETCH_HEAD CHANGED
@@ -1 +1 @@
1
- 6dc2cdf4a84e538e5d4777486aeff87e42f41799 branch 'main' of https://github.com/Jianfengliu0413/py2ls
1
+ 86e288b46f8fe179907e4413f665aeb5053fddb1 branch 'main' of https://github.com/Jianfengliu0413/py2ls
py2ls/.git/index CHANGED
Binary file
py2ls/.git/logs/HEAD CHANGED
@@ -19,3 +19,4 @@ d84688b54c0040a30976b3a6540bc47adf7ce680 32fd627b62fad7cf3b2f9e34ab9777126a0987a
19
19
  1c3f92adda34344bcbbbf9d409c79855ae2aaea8 bf67907e337021ebff434e02b19b30a741c144af Jianfeng <Jianfeng.Liu0413@gmail.com> 1720948339 +0200 commit: update
20
20
  bf67907e337021ebff434e02b19b30a741c144af a15389729850729fc7bd78a54f26fce77f30be12 Jianfeng <Jianfeng.Liu0413@gmail.com> 1721137352 +0200 commit: update ips
21
21
  a15389729850729fc7bd78a54f26fce77f30be12 6dc2cdf4a84e538e5d4777486aeff87e42f41799 Jianfeng <Jianfeng.Liu0413@gmail.com> 1723527985 +0200 commit: update
22
+ 6dc2cdf4a84e538e5d4777486aeff87e42f41799 86e288b46f8fe179907e4413f665aeb5053fddb1 Jianfeng <Jianfeng.Liu0413@gmail.com> 1725537214 +0200 commit: reg_update
@@ -19,3 +19,4 @@ d84688b54c0040a30976b3a6540bc47adf7ce680 32fd627b62fad7cf3b2f9e34ab9777126a0987a
19
19
  1c3f92adda34344bcbbbf9d409c79855ae2aaea8 bf67907e337021ebff434e02b19b30a741c144af Jianfeng <Jianfeng.Liu0413@gmail.com> 1720948339 +0200 commit: update
20
20
  bf67907e337021ebff434e02b19b30a741c144af a15389729850729fc7bd78a54f26fce77f30be12 Jianfeng <Jianfeng.Liu0413@gmail.com> 1721137352 +0200 commit: update ips
21
21
  a15389729850729fc7bd78a54f26fce77f30be12 6dc2cdf4a84e538e5d4777486aeff87e42f41799 Jianfeng <Jianfeng.Liu0413@gmail.com> 1723527985 +0200 commit: update
22
+ 6dc2cdf4a84e538e5d4777486aeff87e42f41799 86e288b46f8fe179907e4413f665aeb5053fddb1 Jianfeng <Jianfeng.Liu0413@gmail.com> 1725537214 +0200 commit: reg_update
@@ -137,3 +137,4 @@ a15389729850729fc7bd78a54f26fce77f30be12 a15389729850729fc7bd78a54f26fce77f30be1
137
137
  a15389729850729fc7bd78a54f26fce77f30be12 a15389729850729fc7bd78a54f26fce77f30be12 Jianfeng Liu <macjianfeng@JFLMBP.cin.medizin.uni-tuebingen.de> 1721326072 +0200 remote set-head
138
138
  a15389729850729fc7bd78a54f26fce77f30be12 a15389729850729fc7bd78a54f26fce77f30be12 Jianfeng Liu <macjianfeng@jflmbp.speedport.ip> 1723527981 +0200 remote set-head
139
139
  6dc2cdf4a84e538e5d4777486aeff87e42f41799 6dc2cdf4a84e538e5d4777486aeff87e42f41799 Jianfeng Liu <macjianfeng@jflmbp.speedport.ip> 1723527990 +0200 remote set-head
140
+ 86e288b46f8fe179907e4413f665aeb5053fddb1 86e288b46f8fe179907e4413f665aeb5053fddb1 Jianfeng Liu <macjianfeng@JFLMBP.cin.medizin.uni-tuebingen.de> 1725537218 +0200 remote set-head
@@ -18,3 +18,4 @@ d84688b54c0040a30976b3a6540bc47adf7ce680 32fd627b62fad7cf3b2f9e34ab9777126a0987a
18
18
  1c3f92adda34344bcbbbf9d409c79855ae2aaea8 bf67907e337021ebff434e02b19b30a741c144af Jianfeng <Jianfeng.Liu0413@gmail.com> 1720948342 +0200 update by push
19
19
  bf67907e337021ebff434e02b19b30a741c144af a15389729850729fc7bd78a54f26fce77f30be12 Jianfeng <Jianfeng.Liu0413@gmail.com> 1721137354 +0200 update by push
20
20
  a15389729850729fc7bd78a54f26fce77f30be12 6dc2cdf4a84e538e5d4777486aeff87e42f41799 Jianfeng <Jianfeng.Liu0413@gmail.com> 1723527989 +0200 update by push
21
+ 6dc2cdf4a84e538e5d4777486aeff87e42f41799 86e288b46f8fe179907e4413f665aeb5053fddb1 Jianfeng <Jianfeng.Liu0413@gmail.com> 1725537218 +0200 update by push
@@ -1 +1 @@
1
- 6dc2cdf4a84e538e5d4777486aeff87e42f41799
1
+ 86e288b46f8fe179907e4413f665aeb5053fddb1
@@ -1 +1 @@
1
- 6dc2cdf4a84e538e5d4777486aeff87e42f41799
1
+ 86e288b46f8fe179907e4413f665aeb5053fddb1
py2ls/batman.py ADDED
@@ -0,0 +1,198 @@
1
+ import smtplib
2
+ from email.mime.text import MIMEText
3
+ from email.mime.multipart import MIMEMultipart
4
+ from email.mime.base import MIMEBase
5
+ from email import encoders
6
+ import schedule
7
+ import time
8
+ from datetime import datetime
9
+ import os
10
+ from pprint import pp
11
+ import json
12
+
13
+
14
+ def extract_kv(
15
+ dir_data="/Users/macjianfeng/Dropbox/github/python/py2ls/confidential_data/gmail_login.json",
16
+ idx=0,
17
+ ): # select the index
18
+ with open(dir_data, "r") as file:
19
+ email_login = json.load(file)
20
+ for i, (user, pd) in enumerate(email_login.items()):
21
+ if i == idx:
22
+ return user, pd
23
+
24
+
25
+ def email_to(**kwargs):
26
+ """
27
+ usage:
28
+ email_to(who="example@gmail.com",
29
+ subject="test",
30
+ what="this is the body",
31
+ attachments="/Users/test.pdf")
32
+ Send an email with optional attachments.
33
+
34
+ :param who: Recipient email address
35
+ :param subject: Email subject
36
+ :param what: Email what
37
+ :param attachments: List of file paths to attach
38
+ """
39
+ who, what, subject = None, None, None
40
+ attachments = False
41
+ pause_sec = False # default 10 seconds pause
42
+
43
+ signature_styles = extract_kv(idx=1)[1] # signature list
44
+ signature = signature_styles[0] # default signature,None
45
+ verbose = True
46
+
47
+ # params config
48
+ for k, v in kwargs.items():
49
+ if any(
50
+ [
51
+ "who" in k.lower(),
52
+ "whe" in k.lower(),
53
+ all(["@" in k.lower(), "." in k.lower()]),
54
+ ]
55
+ ): # 'who' or "where"
56
+ who = v
57
+ if any(["sub" in k.lower(), "hea" in k.lower()]): # 'subject', 'header'
58
+ subject = v
59
+ if any(
60
+ ["wha" in k.lower(), "con" in k.lower(), "bod" in k.lower()]
61
+ ): # 'what','content','body'
62
+ what = v
63
+ if any(["att" in k.lower(), "fil" in k.lower()]): # 'attachments', 'file'
64
+ attachments = v # optional
65
+ if any(
66
+ ["paus" in k.lower(), "tim" in k.lower(), "delay" in k.lower()]
67
+ ): # 'attachments', 'file'
68
+ pause_sec = v # optional
69
+ if any(["sig" in k.lower()]): # 'attachments', 'file'
70
+ signature = v # optional
71
+ if not isinstance(v, str):
72
+ print(signature_styles)
73
+ signature = signature_styles[v]
74
+ if any(["verb" in k.lower(), "show" in k.lower()]): # 'verbose', 'show'
75
+ verbose = v # verbose
76
+
77
+ # Create email message
78
+ message = MIMEMultipart()
79
+ message["From"] = extract_kv()[0]
80
+ message["To"] = who
81
+ message["Subject"] = subject
82
+
83
+ # add signature
84
+ if signature:
85
+ what += f"\n\n{signature}\n"
86
+
87
+ # the eamil's body
88
+ message.attach(MIMEText(what, "plain"))
89
+
90
+ # attach files
91
+ if attachments:
92
+ if isinstance(attachments, str):
93
+ attachments = [attachments]
94
+ for file in attachments:
95
+ part = MIMEBase("application", "octet-stream")
96
+ try:
97
+ with open(file, "rb") as attachment:
98
+ part.set_payload(attachment.read())
99
+ encoders.encode_base64(part)
100
+
101
+ part.add_header(
102
+ "Content-Disposition",
103
+ f'attachment; filename= "{os.path.basename(file)}"',
104
+ )
105
+ message.attach(part)
106
+ except FileNotFoundError:
107
+ print(f"File not found: {file}")
108
+ except Exception as e:
109
+ print(f"Error attaching file {file}: {e}")
110
+ if pause_sec:
111
+ time.sleep(pause_sec)
112
+
113
+ # Send the email
114
+ try:
115
+ with smtplib.SMTP("smtp.gmail.com", 587) as server:
116
+ server.starttls()
117
+ server.login(extract_kv()[0], extract_kv()[1])
118
+ server.sendmail(extract_kv()[0], who, message.as_string())
119
+ if verbose:
120
+ if attachments:
121
+ print(
122
+ f'\nEmail successfully sent to:\nto:"{who}"\nsubject:{subject}\nattached:'
123
+ )
124
+ pp(attachments)
125
+ else:
126
+ print(f'\nEmail successfully sent to:\nto:"{who}"\nsubject:{subject}')
127
+ except Exception as e:
128
+ print(f"Failed to send email: {e}")
129
+
130
+
131
+ def email_to_every(who, subject, what, when, attachments=None):
132
+ """
133
+ Check the time and send an email when the time matches the when.
134
+
135
+ :param who: Recipient email address
136
+ :param subject: Email subject
137
+ :param what: Email what
138
+ :param when: Time to send the email in HH:MM format
139
+ :param attachments: List of file paths to attach
140
+ """
141
+ current_time = datetime.now().strftime("%H:%M")
142
+ if current_time == when:
143
+ email_to(
144
+ who=who,
145
+ subject=subject,
146
+ what=what,
147
+ attachments=attachments,
148
+ )
149
+
150
+
151
+ # Example usage
152
+ def example_job():
153
+ # Example email details
154
+ reminder_subject = "Reminder: Important Meeting Tomorrow"
155
+ reminder_what = (
156
+ "Don't forget about the meeting tomorrow at 10 AM in the conference room."
157
+ )
158
+ who = "Jianfeng.Liu0413@gmail.com"
159
+ when = "14:30" # Send time in 24-hour format
160
+
161
+ # Optional attachments
162
+ attachments = ["path/to/attachment1.pdf", "path/to/attachment2.jpg"]
163
+
164
+ # Schedule the email
165
+ email_to_every(who, reminder_subject, reminder_what, when, attachments)
166
+
167
+
168
+ if __name__ == "__main__":
169
+ pass
170
+ # # Schedule the job to run every minute
171
+ # schedule.every(1).minutes.do(example_job)
172
+
173
+ # while True:
174
+ # schedule.run_pending()
175
+ # time.sleep(1)
176
+
177
+ # # example2:
178
+ # email_to(
179
+ # who="Jianfeng.Liu@medizin.uni-tuebingen.de",
180
+ # subj="test",
181
+ # wha="this is the body",
182
+ # signat="\n\n Best, Jianfeng\n",
183
+ # att="/Users/macjianfeng/Dropbox/Downloads/_*_doc-xlsx/20240822-preprints_full_20190101_20201031-2.xlsx",
184
+ # )
185
+
186
+ # # example3:
187
+ # email_to(
188
+ # who="Jianfeng.Liu@medizin.uni-tuebingen.de",
189
+ # subj="test",
190
+ # wha="this is the test",
191
+ # signat=2,
192
+ # # att="/Users/macjianfeng/Dropbox/Downloads/_*_doc-xlsx/20240822-preprints_full_20190101_20201031-2.xlsx",
193
+ # )
194
+
195
+ # # example_4
196
+ # print(extract_kv(idx=0))
197
+ # print(extract_kv(idx=0)[0])
198
+ # print(extract_kv(idx=1))