py2ls 0.1.8.3__py3-none-any.whl → 0.1.8.4__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/ips.py
CHANGED
@@ -457,13 +457,15 @@ def str2date(date_str, fmt="%Y-%m-%d_%H:%M:%S"):
|
|
457
457
|
# print(str2)
|
458
458
|
|
459
459
|
|
460
|
-
def str2num(s, *args):
|
461
|
-
delimiter = None
|
462
|
-
round_digits = None
|
460
|
+
def str2num(s, *args, **kwargs):
|
461
|
+
delimiter = kwargs.get("sep", None)
|
462
|
+
round_digits = kwargs.get("round", None)
|
463
|
+
if delimiter is not None:
|
464
|
+
s = s.replace(delimiter, "")
|
463
465
|
for arg in args:
|
464
|
-
if isinstance(arg, str):
|
466
|
+
if isinstance(arg, str) and delimiter is None:
|
465
467
|
delimiter = arg
|
466
|
-
elif isinstance(arg, int):
|
468
|
+
elif isinstance(arg, int) and round_digits is None:
|
467
469
|
round_digits = arg
|
468
470
|
try:
|
469
471
|
num = int(s)
|
@@ -491,17 +493,17 @@ def str2num(s, *args):
|
|
491
493
|
"Multiple number segments found, cannot determine single numeric value"
|
492
494
|
)
|
493
495
|
except Exception as e:
|
494
|
-
|
496
|
+
return None
|
495
497
|
|
496
498
|
# Apply rounding if specified
|
497
499
|
if round_digits is not None:
|
498
500
|
num_adj = num + 0.00000000001 # Ensure precise rounding
|
499
501
|
num = round(num_adj, round_digits)
|
500
|
-
|
501
|
-
|
502
|
-
if delimiter is not None:
|
503
|
-
|
504
|
-
|
502
|
+
if round_digits == 0:
|
503
|
+
num = int(num)
|
504
|
+
# if delimiter is not None:
|
505
|
+
# num_str = f"{num:,}".replace(",", delimiter)
|
506
|
+
# return num_str#s.replace(delimiter, "")
|
505
507
|
|
506
508
|
return num
|
507
509
|
|
@@ -516,9 +518,9 @@ def str2num(s, *args):
|
|
516
518
|
# print(str2num("12345.6789", " ", 2)) # Output: 12 345.68
|
517
519
|
# print(str2num('111113.34555',3,',')) # Output: 111,113.346
|
518
520
|
# print(str2num("123.55555 sec miniuets",3)) # Output: 1.3
|
519
|
-
def num2str(num, *args):
|
520
|
-
delimiter = None
|
521
|
-
round_digits = None
|
521
|
+
def num2str(num, *args, **kwargs):
|
522
|
+
delimiter = kwargs.get("sep", None)
|
523
|
+
round_digits = kwargs.get("round", None)
|
522
524
|
|
523
525
|
# Parse additional arguments
|
524
526
|
for arg in args:
|
@@ -134,7 +134,7 @@ py2ls/db2ls.py,sha256=MMfFX47aIPIyu7fU9aPvX9lbPRPYOpJ_VXwlnWk-8qo,13615
|
|
134
134
|
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
|
-
py2ls/ips.py,sha256=
|
137
|
+
py2ls/ips.py,sha256=mBFTARM6Pvj5EaVRR05CXCBlyNcbX2JfMQWBjnxONjI,100773
|
138
138
|
py2ls/netfinder.py,sha256=MY_0TQY_zaRBZ6wfR4RxNCGrU93HFmDVDRRy1EXl75o,47566
|
139
139
|
py2ls/plot.py,sha256=WIAUDd4cRjFTX_Y_SWwsSw9_gIQF_Ye6R_-MvhB9G1k,50437
|
140
140
|
py2ls/setuptools-70.1.0-py3-none-any.whl,sha256=2bi3cUVal8ip86s0SOvgspteEF8SKLukECi-EWmFomc,882588
|
@@ -142,6 +142,6 @@ py2ls/sleep_events_detectors.py,sha256=bQA3HJqv5qnYKJJEIhCyhlDtkXQfIzqksnD0YRXso
|
|
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.8.
|
146
|
-
py2ls-0.1.8.
|
147
|
-
py2ls-0.1.8.
|
145
|
+
py2ls-0.1.8.4.dist-info/METADATA,sha256=ieFZ6Fgi3Tw6gIm1kdxkpLbk3XMgEwJ7uUIZTjSr-eo,20017
|
146
|
+
py2ls-0.1.8.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
147
|
+
py2ls-0.1.8.4.dist-info/RECORD,,
|
File without changes
|