py2ls 0.1.7.5__py3-none-any.whl → 0.1.7.7__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.
py2ls/netfinder.py
CHANGED
@@ -116,11 +116,18 @@ def extract_text_from_content(content, content_type="text/html", where=None, wha
|
|
116
116
|
texts = ""
|
117
117
|
for tag in result_set:
|
118
118
|
texts =texts+" "+ extract_text(tag) + " \n"
|
119
|
-
text_list = [tx.strip() for tx in texts.split("\n") if tx.strip()]
|
119
|
+
text_list = [tx.strip() for tx in texts.split(" \n") if tx.strip()]
|
120
120
|
return text_list
|
121
121
|
else:
|
122
|
-
texts_ = " ".join(tag.get_text() for tag in result_set)
|
123
|
-
|
122
|
+
# texts_ = " ".join(tag.get_text() for tag in result_set)
|
123
|
+
texts_=[]
|
124
|
+
for tag in result_set:
|
125
|
+
for child in tag.children:
|
126
|
+
if child.name is None:
|
127
|
+
texts_.append(child.strip())
|
128
|
+
# texts_=" ".join(texts_)
|
129
|
+
# texts = [tx.strip() for tx in texts_.split("\n") if tx.strip()]
|
130
|
+
texts = [tx.strip() for tx in texts_ if tx.strip()]
|
124
131
|
return texts
|
125
132
|
|
126
133
|
def extract_text_from_json(content, key=None):
|
@@ -493,6 +500,7 @@ def downloader(url, dir_save=dir_save, kind=['.pdf'], contains=None, rm_folder=F
|
|
493
500
|
new_filename = f"{base}_{counter_}{ext}"
|
494
501
|
counter += 1
|
495
502
|
return new_filename
|
503
|
+
fpath_tmp, corrected_fname=None, None
|
496
504
|
if not isinstance(kind,list):
|
497
505
|
kind=[kind]
|
498
506
|
if isinstance(url, list):
|
@@ -578,7 +586,7 @@ def downloader(url, dir_save=dir_save, kind=['.pdf'], contains=None, rm_folder=F
|
|
578
586
|
except (ChunkedEncodingError, ConnectionError) as e:
|
579
587
|
print(f"Attempt {itry+1} failed: {e}. Retrying in a few seconds...")
|
580
588
|
# time.sleep(random.uniform(0, 2)) # Random sleep to mitigate server issues
|
581
|
-
if os.path.exists(fpath_tmp):
|
589
|
+
if fpath_tmp and os.path.exists(fpath_tmp):
|
582
590
|
os.remove(fpath_tmp)
|
583
591
|
itry += 1
|
584
592
|
|
@@ -587,7 +595,10 @@ def downloader(url, dir_save=dir_save, kind=['.pdf'], contains=None, rm_folder=F
|
|
587
595
|
|
588
596
|
print(f'\n{len(fnames)} files were downloaded:')
|
589
597
|
if verbose:
|
590
|
-
|
598
|
+
if corrected_fname:
|
599
|
+
pp(corrected_fname)
|
600
|
+
else:
|
601
|
+
pp(fnames)
|
591
602
|
print(f"\n\nsaved @:\n{dir_save}")
|
592
603
|
|
593
604
|
def find_img(url, driver='request',dir_save="images", rm_folder=False, verbose=True):
|
py2ls/sleep_events_detectors.py
CHANGED
@@ -162,6 +162,11 @@ def detect_cross(data, thr=0):
|
|
162
162
|
falling_before.pop(0)
|
163
163
|
if len(rising_before) > len(falling_before):
|
164
164
|
rising_before.pop(0)
|
165
|
+
if rising_before and falling_before:
|
166
|
+
return rising_before, falling_before
|
167
|
+
else:
|
168
|
+
signal_shifted = data - thr
|
169
|
+
return np.where(np.diff(np.sign(signal_shifted)))[0]
|
165
170
|
## debug
|
166
171
|
# a = np.sin(np.arange(0, 10 * np.pi, np.pi / 100))
|
167
172
|
|
@@ -188,8 +193,6 @@ def detect_cross(data, thr=0):
|
|
188
193
|
# lw=5 - i,
|
189
194
|
# )
|
190
195
|
# plt.gca().axhline(thres)
|
191
|
-
return rising_before, falling_before
|
192
|
-
|
193
196
|
def find_repeats(data, N, nGap=None):
|
194
197
|
"""
|
195
198
|
Find the beginning and end points of repeated occurrences in a dataset.
|
@@ -135,13 +135,13 @@ py2ls/doc.py,sha256=xN3g1OWfoaGUhikbJ0NqbN5eKy1VZVvWwRlhHMgyVEc,4243
|
|
135
135
|
py2ls/export_requirements.py,sha256=x2WgUF0jYKz9GfA1MVKN-MdsM-oQ8yUeC6Ua8oCymio,2325
|
136
136
|
py2ls/freqanalysis.py,sha256=F4218VSPbgL5tnngh6xNCYuNnfR-F_QjECUUxrPYZss,32594
|
137
137
|
py2ls/ips.py,sha256=KkrkGAF0VQ-N0rH4FQFLyP-C-skY6EPpeO8t_5RngWw,88519
|
138
|
-
py2ls/netfinder.py,sha256=
|
138
|
+
py2ls/netfinder.py,sha256=MY_0TQY_zaRBZ6wfR4RxNCGrU93HFmDVDRRy1EXl75o,47566
|
139
139
|
py2ls/plot.py,sha256=8_33-1wpkGZrDUuvRBfTPUi_BRKdf1njoR725OLSLSY,48579
|
140
140
|
py2ls/setuptools-70.1.0-py3-none-any.whl,sha256=2bi3cUVal8ip86s0SOvgspteEF8SKLukECi-EWmFomc,882588
|
141
|
-
py2ls/sleep_events_detectors.py,sha256=
|
141
|
+
py2ls/sleep_events_detectors.py,sha256=Y0cbM1yHbIxIYEnFICZSHmQWO31nZGZUMcH07kTbiQ4,51697
|
142
142
|
py2ls/stats.py,sha256=Wd9yCKQ_61QD29WMEgMuEcreFxF91NmlPW65iWT2B5w,39041
|
143
143
|
py2ls/translator.py,sha256=bc5FB-wqC4TtQz9gyCP1mE38HqNRJ_pmuRIgKnAlMzM,30581
|
144
144
|
py2ls/wb_detector.py,sha256=7y6TmBUj9exCZeIgBAJ_9hwuhkDh1x_-yg4dvNY1_GQ,6284
|
145
|
-
py2ls-0.1.7.
|
146
|
-
py2ls-0.1.7.
|
147
|
-
py2ls-0.1.7.
|
145
|
+
py2ls-0.1.7.7.dist-info/METADATA,sha256=x7zPhd_n4VHVZQmjLcZaa6525qNXyWoM6YTDOUDeqmw,20017
|
146
|
+
py2ls-0.1.7.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
147
|
+
py2ls-0.1.7.7.dist-info/RECORD,,
|
File without changes
|