dycw-utilities 0.168.0__py3-none-any.whl → 0.168.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.
Potentially problematic release.
This version of dycw-utilities might be problematic. Click here for more details.
- {dycw_utilities-0.168.0.dist-info → dycw_utilities-0.168.1.dist-info}/METADATA +2 -2
- {dycw_utilities-0.168.0.dist-info → dycw_utilities-0.168.1.dist-info}/RECORD +15 -15
- utilities/__init__.py +1 -1
- utilities/click.py +9 -9
- utilities/hypothesis.py +1 -1
- utilities/orjson.py +17 -17
- utilities/parse.py +2 -2
- utilities/pytest.py +2 -2
- utilities/timer.py +2 -2
- utilities/traceback.py +1 -1
- utilities/typed_settings.py +9 -9
- utilities/whenever.py +5 -5
- {dycw_utilities-0.168.0.dist-info → dycw_utilities-0.168.1.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.168.0.dist-info → dycw_utilities-0.168.1.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.168.0.dist-info → dycw_utilities-0.168.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dycw-utilities
|
|
3
|
-
Version: 0.168.
|
|
3
|
+
Version: 0.168.1
|
|
4
4
|
Author-email: Derek Wan <d.wan@icloud.com>
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.12
|
|
7
7
|
Requires-Dist: atomicwrites<1.5,>=1.4.1
|
|
8
8
|
Requires-Dist: typing-extensions<4.16,>=4.15.0
|
|
9
9
|
Requires-Dist: tzlocal<5.4,>=5.3.1
|
|
10
|
-
Requires-Dist: whenever<0.
|
|
10
|
+
Requires-Dist: whenever<0.10,>=0.9.0
|
|
11
11
|
Provides-Extra: logging
|
|
12
12
|
Requires-Dist: coloredlogs<15.1,>=15.0.1; extra == 'logging'
|
|
13
13
|
Provides-Extra: test
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
utilities/__init__.py,sha256=
|
|
1
|
+
utilities/__init__.py,sha256=OrbMLBGcu3xLdMPQ4r4I_hMdXdAIG1S5Jw5pNJuMvfk,60
|
|
2
2
|
utilities/aeventkit.py,sha256=OmDBhYGgbsKrB7cdC5FFpJHUatX9O76eTeKVVTksp2Y,12673
|
|
3
3
|
utilities/altair.py,sha256=nHdpWt8ZwdUwRQN970MvHd5bRWokNqzHcZQEdSHKRuE,9033
|
|
4
4
|
utilities/asyncio.py,sha256=60l1IwjnRGeaVphAFiwDIHyfKoZYKY-XGpptUxGiU-M,17034
|
|
5
5
|
utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
|
|
6
6
|
utilities/atools.py,sha256=6neeCcgXxK2dlsc0xp15Za7nSucbCgFtAJepGI_-WXU,2549
|
|
7
7
|
utilities/cachetools.py,sha256=v1-9sXHLdOLiwmkq6NB0OUbxeKBuVVN6wmAWefWoaHI,2744
|
|
8
|
-
utilities/click.py,sha256=
|
|
8
|
+
utilities/click.py,sha256=pUkrC4F4HZlBNF4KmQ3sEsDe0VtyMspVepKVUvDvuhs,17386
|
|
9
9
|
utilities/concurrent.py,sha256=fHeW2SZ_TEMfFY0C8pyQI6aPlnecvx9x6SuUwBWj_JY,2853
|
|
10
10
|
utilities/contextlib.py,sha256=iP7R2tIm6ZsbfLD5ks6UKBYwj50e9gBI8AkpLN-chro,7476
|
|
11
11
|
utilities/contextvars.py,sha256=J8OhC7jqozAGYOCe2KUWysbPXNGe5JYz3HfaY_mIs08,883
|
|
@@ -24,7 +24,7 @@ utilities/git.py,sha256=U1RFvCTANGENgx9wVBDvllioqBQZM2ns12ivKhOsaO4,414
|
|
|
24
24
|
utilities/gzip.py,sha256=fkGP3KdsBfXlstodT4wtlp-PwNyUsogpbDCVVVGdsm4,781
|
|
25
25
|
utilities/hashlib.py,sha256=SVTgtguur0P4elppvzOBbLEjVM3Pea0eWB61yg2ilxo,309
|
|
26
26
|
utilities/http.py,sha256=TsavEfHlRtlLaeV21Z6KZh0qbPw-kvD1zsQdZ7Kep5Q,977
|
|
27
|
-
utilities/hypothesis.py,sha256
|
|
27
|
+
utilities/hypothesis.py,sha256=-kijlvGxyreHnEba5NUkYEUdKUonF80NxkO7QeSvDdk,45531
|
|
28
28
|
utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
|
|
29
29
|
utilities/inflect.py,sha256=v7YkOWSu8NAmVghPcf4F3YBZQoJCS47_DLf9jbfWIs0,581
|
|
30
30
|
utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
|
|
@@ -42,9 +42,9 @@ utilities/more_itertools.py,sha256=syfIPhQF_WS-YiicdGe2h5F1G-Ld12Q2XsVduL2hA40,1
|
|
|
42
42
|
utilities/numpy.py,sha256=Xn23sA2ZbVNqwUYEgNJD3XBYH6IbCri_WkHSNhg3NkY,26122
|
|
43
43
|
utilities/operator.py,sha256=C3NylZWGTVWRpwYHOPVhaLgRhw0DfpS4_XQ8KfPhBLQ,3613
|
|
44
44
|
utilities/optuna.py,sha256=C-fhWYiXHVPo1l8QctYkFJ4DyhbSrGorzP1dJb_qvd8,1933
|
|
45
|
-
utilities/orjson.py,sha256=
|
|
45
|
+
utilities/orjson.py,sha256=PF1TUS3uR9wZH5iMkmv24arIH2TvrLKmpVRLMlVFm-o,41879
|
|
46
46
|
utilities/os.py,sha256=MQxP4yVsV0sg8nPQyC8rctnimJdys_PvzxqDZfVzMMs,3935
|
|
47
|
-
utilities/parse.py,sha256=
|
|
47
|
+
utilities/parse.py,sha256=g7Qm9eBOIeDId2tGA021CIaeF6jp1TI8rx4srdvlyoo,17937
|
|
48
48
|
utilities/pathlib.py,sha256=X6pHmfT3hnBGysdTr73uHsNaBEgKviZhk7aGWvEXDXo,8912
|
|
49
49
|
utilities/pickle.py,sha256=MBT2xZCsv0pH868IXLGKnlcqNx2IRVKYNpRcqiQQqxw,653
|
|
50
50
|
utilities/platform.py,sha256=pTn7gw6N4T6LdKrf0virwarof_mze9WtoQlrGMzhGVI,2798
|
|
@@ -58,7 +58,7 @@ utilities/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
58
58
|
utilities/pydantic_settings.py,sha256=wwuvW12ZVhJfoAJoiQpVT8EDVyNm79H3cWJR7u-wMQo,5115
|
|
59
59
|
utilities/pydantic_settings_sops.py,sha256=9Ou6Cx6PiYOU49vtkKqqW1Sdp_i3WlVyg8KkUUKNliM,2310
|
|
60
60
|
utilities/pyinstrument.py,sha256=hnXaL-4HE7wWBI5JKaPfYTpsrXe68YiuZKahHV0VJn8,841
|
|
61
|
-
utilities/pytest.py,sha256=
|
|
61
|
+
utilities/pytest.py,sha256=6o2qoAPygQLveU8t1JOdzAGmZ96Hs5jFn9OT_mcDNCk,10062
|
|
62
62
|
utilities/pytest_regressions.py,sha256=vkMH4swF1LVK2117k9cenm9BhVFiTTRwK3Ys_X2wyGI,4045
|
|
63
63
|
utilities/random.py,sha256=hZlH4gnAtoaofWswuJYjcygejrY8db4CzP-z_adO2Mo,4165
|
|
64
64
|
utilities/re.py,sha256=S4h-DLL6ScMPqjboZ_uQ1BVTJajrqV06r_81D--_HCE,4573
|
|
@@ -77,9 +77,9 @@ utilities/tempfile.py,sha256=HxB2BF28CcecDJLQ3Bx2Ej-Pb6RJc6W9ngSpB9CnP4k,2018
|
|
|
77
77
|
utilities/testbook.py,sha256=j1KmaVbrX9VrbeMgtPh5gk55myAsn3dyRUn7jGbPbRk,1294
|
|
78
78
|
utilities/text.py,sha256=7SvwcSR2l_5cOrm1samGnR4C-ZI6qyFLHLzSpO1zeHQ,13958
|
|
79
79
|
utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
|
80
|
-
utilities/timer.py,sha256=
|
|
81
|
-
utilities/traceback.py,sha256
|
|
82
|
-
utilities/typed_settings.py,sha256=
|
|
80
|
+
utilities/timer.py,sha256=BGlwEVznx67scuLOUohyWJ4d5rTnwtk-IR4yLXFiNfo,2574
|
|
81
|
+
utilities/traceback.py,sha256=B_sc0TRUv-mGDnF-ek05nbqjmBiHr3-wvxliAqIF5hI,9608
|
|
82
|
+
utilities/typed_settings.py,sha256=WJikhgV_92GkjqdQQ2VxfVrwABE5d_Z6tczmcr3H57w,4581
|
|
83
83
|
utilities/types.py,sha256=IlRrCtPdLkGYVfpe-QIg2qNUgBr8OJNN7BhTKxnhh-M,18817
|
|
84
84
|
utilities/typing.py,sha256=QYoCIc71e_u5W-kBeiNzrD-GXxpLtMOGc9PqgZjMXeE,25274
|
|
85
85
|
utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
|
|
@@ -87,14 +87,14 @@ utilities/tzlocal.py,sha256=KyCXEgCTjqGFx-389JdTuhMRUaT06U1RCMdWoED-qro,728
|
|
|
87
87
|
utilities/uuid.py,sha256=nQZs6tFX4mqtc2Ku3KqjloYCqwpTKeTj8eKwQwh3FQI,1572
|
|
88
88
|
utilities/version.py,sha256=ipBj5-WYY_nelp2uwFlApfWWCzTLzPwpovUi9x_OBMs,5085
|
|
89
89
|
utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
90
|
-
utilities/whenever.py,sha256=
|
|
90
|
+
utilities/whenever.py,sha256=F4ek0-OBWxHYrZdmoZt76N2RnNyKY5KrEHt7rqO4AQE,60183
|
|
91
91
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
|
92
92
|
utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
|
|
93
93
|
utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
94
94
|
utilities/pytest_plugins/pytest_randomly.py,sha256=B1qYVlExGOxTywq2r1SMi5o7btHLk2PNdY_b1p98dkE,409
|
|
95
95
|
utilities/pytest_plugins/pytest_regressions.py,sha256=mnHYBfdprz50UGVkVzV1bZERZN5CFfoF8YbokGxdFwU,1639
|
|
96
|
-
dycw_utilities-0.168.
|
|
97
|
-
dycw_utilities-0.168.
|
|
98
|
-
dycw_utilities-0.168.
|
|
99
|
-
dycw_utilities-0.168.
|
|
100
|
-
dycw_utilities-0.168.
|
|
96
|
+
dycw_utilities-0.168.1.dist-info/METADATA,sha256=7jVdRmilyNEQ9D64FlUih9pQEMUGQwKz0SvvbkcKgr4,1699
|
|
97
|
+
dycw_utilities-0.168.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
98
|
+
dycw_utilities-0.168.1.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
|
99
|
+
dycw_utilities-0.168.1.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
|
100
|
+
dycw_utilities-0.168.1.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/click.py
CHANGED
|
@@ -72,7 +72,7 @@ class Date(ParamType):
|
|
|
72
72
|
return value
|
|
73
73
|
case str():
|
|
74
74
|
try:
|
|
75
|
-
return whenever.Date.
|
|
75
|
+
return whenever.Date.parse_iso(value)
|
|
76
76
|
except ValueError as error:
|
|
77
77
|
self.fail(str(error), param, ctx)
|
|
78
78
|
case never:
|
|
@@ -98,7 +98,7 @@ class DateDelta(ParamType):
|
|
|
98
98
|
return value
|
|
99
99
|
case str():
|
|
100
100
|
try:
|
|
101
|
-
return whenever.DateDelta.
|
|
101
|
+
return whenever.DateDelta.parse_iso(value)
|
|
102
102
|
except ValueError as error:
|
|
103
103
|
self.fail(str(error), param, ctx)
|
|
104
104
|
case never:
|
|
@@ -124,7 +124,7 @@ class DateTimeDelta(ParamType):
|
|
|
124
124
|
return value
|
|
125
125
|
case str():
|
|
126
126
|
try:
|
|
127
|
-
return whenever.DateTimeDelta.
|
|
127
|
+
return whenever.DateTimeDelta.parse_iso(value)
|
|
128
128
|
except ValueError as error:
|
|
129
129
|
self.fail(str(error), param, ctx)
|
|
130
130
|
case never:
|
|
@@ -235,7 +235,7 @@ class MonthDay(ParamType):
|
|
|
235
235
|
return value
|
|
236
236
|
case str():
|
|
237
237
|
try:
|
|
238
|
-
return whenever.MonthDay.
|
|
238
|
+
return whenever.MonthDay.parse_iso(value)
|
|
239
239
|
except ValueError as error:
|
|
240
240
|
self.fail(str(error), param, ctx)
|
|
241
241
|
case never:
|
|
@@ -284,7 +284,7 @@ class PlainDateTime(ParamType):
|
|
|
284
284
|
return value
|
|
285
285
|
case str():
|
|
286
286
|
try:
|
|
287
|
-
return whenever.PlainDateTime.
|
|
287
|
+
return whenever.PlainDateTime.parse_iso(value)
|
|
288
288
|
except ValueError as error:
|
|
289
289
|
self.fail(str(error), param, ctx)
|
|
290
290
|
case never:
|
|
@@ -310,7 +310,7 @@ class Time(ParamType):
|
|
|
310
310
|
return value
|
|
311
311
|
case str():
|
|
312
312
|
try:
|
|
313
|
-
return whenever.Time.
|
|
313
|
+
return whenever.Time.parse_iso(value)
|
|
314
314
|
except ValueError as error:
|
|
315
315
|
self.fail(str(error), param, ctx)
|
|
316
316
|
case never:
|
|
@@ -336,7 +336,7 @@ class TimeDelta(ParamType):
|
|
|
336
336
|
return value
|
|
337
337
|
case str():
|
|
338
338
|
try:
|
|
339
|
-
return whenever.TimeDelta.
|
|
339
|
+
return whenever.TimeDelta.parse_iso(value)
|
|
340
340
|
except ValueError as error:
|
|
341
341
|
self.fail(str(error), param, ctx)
|
|
342
342
|
case never:
|
|
@@ -388,7 +388,7 @@ class YearMonth(ParamType):
|
|
|
388
388
|
return value
|
|
389
389
|
case str():
|
|
390
390
|
try:
|
|
391
|
-
return whenever.YearMonth.
|
|
391
|
+
return whenever.YearMonth.parse_iso(value)
|
|
392
392
|
except ValueError as error:
|
|
393
393
|
self.fail(str(error), param, ctx)
|
|
394
394
|
case never:
|
|
@@ -414,7 +414,7 @@ class ZonedDateTime(ParamType):
|
|
|
414
414
|
return value
|
|
415
415
|
case str():
|
|
416
416
|
try:
|
|
417
|
-
return whenever.ZonedDateTime.
|
|
417
|
+
return whenever.ZonedDateTime.parse_iso(value)
|
|
418
418
|
except ValueError as error:
|
|
419
419
|
self.fail(str(error), param, ctx)
|
|
420
420
|
case never:
|
utilities/hypothesis.py
CHANGED
|
@@ -1570,7 +1570,7 @@ def zoned_date_times(
|
|
|
1570
1570
|
with (
|
|
1571
1571
|
assume_does_not_raise(RepeatedTime),
|
|
1572
1572
|
assume_does_not_raise(SkippedTime),
|
|
1573
|
-
assume_does_not_raise(ValueError, match=r"Resulting
|
|
1573
|
+
assume_does_not_raise(ValueError, match=r"Resulting time is out of range"),
|
|
1574
1574
|
):
|
|
1575
1575
|
zoned = plain.assume_tz(time_zone_.key, disambiguate="raise")
|
|
1576
1576
|
with assume_does_not_raise(OverflowError, match=r"date value out of range"):
|
utilities/orjson.py
CHANGED
|
@@ -481,49 +481,49 @@ def _object_hook(
|
|
|
481
481
|
if match := _NONE_PATTERN.search(text):
|
|
482
482
|
return None
|
|
483
483
|
if match := _DATE_PATTERN.search(text):
|
|
484
|
-
return Date.
|
|
484
|
+
return Date.parse_iso(match.group(1))
|
|
485
485
|
if match := _DATE_DELTA_PATTERN.search(text):
|
|
486
|
-
return DateDelta.
|
|
486
|
+
return DateDelta.parse_iso(match.group(1))
|
|
487
487
|
if match := _DATE_PERIOD_PATTERN.search(text):
|
|
488
|
-
start, end = map(Date.
|
|
488
|
+
start, end = map(Date.parse_iso, match.group(1).split(","))
|
|
489
489
|
return DatePeriod(start, end)
|
|
490
490
|
if match := _DATE_TIME_DELTA_PATTERN.search(text):
|
|
491
|
-
return DateTimeDelta.
|
|
491
|
+
return DateTimeDelta.parse_iso(match.group(1))
|
|
492
492
|
if match := _FLOAT_PATTERN.search(text):
|
|
493
493
|
return float(match.group(1))
|
|
494
494
|
if match := _MONTH_DAY_PATTERN.search(text):
|
|
495
|
-
return MonthDay.
|
|
495
|
+
return MonthDay.parse_iso(match.group(1))
|
|
496
496
|
if match := _PATH_PATTERN.search(text):
|
|
497
497
|
return Path(match.group(1))
|
|
498
498
|
if match := _PLAIN_DATE_TIME_PATTERN.search(text):
|
|
499
|
-
return PlainDateTime.
|
|
499
|
+
return PlainDateTime.parse_iso(match.group(1))
|
|
500
500
|
if match := _PY_DATE_PATTERN.search(text):
|
|
501
|
-
return Date.
|
|
501
|
+
return Date.parse_iso(match.group(1)).py_date()
|
|
502
502
|
if match := _PY_PLAIN_DATE_TIME_PATTERN.search(text):
|
|
503
|
-
return PlainDateTime.
|
|
503
|
+
return PlainDateTime.parse_iso(match.group(1)).py_datetime()
|
|
504
504
|
if match := _PY_TIME_PATTERN.search(text):
|
|
505
|
-
return Time.
|
|
505
|
+
return Time.parse_iso(match.group(1)).py_time()
|
|
506
506
|
if match := _PY_ZONED_DATE_TIME_PATTERN.search(text):
|
|
507
|
-
return ZonedDateTime.
|
|
507
|
+
return ZonedDateTime.parse_iso(match.group(1)).py_datetime()
|
|
508
508
|
if match := _TIME_PATTERN.search(text):
|
|
509
|
-
return Time.
|
|
509
|
+
return Time.parse_iso(match.group(1))
|
|
510
510
|
if match := _TIME_DELTA_PATTERN.search(text):
|
|
511
|
-
return TimeDelta.
|
|
511
|
+
return TimeDelta.parse_iso(match.group(1))
|
|
512
512
|
if match := _TIME_PERIOD_PATTERN.search(text):
|
|
513
|
-
start, end = map(Time.
|
|
513
|
+
start, end = map(Time.parse_iso, match.group(1).split(","))
|
|
514
514
|
return TimePeriod(start, end)
|
|
515
515
|
if match := _UUID_PATTERN.search(text):
|
|
516
516
|
return UUID(match.group(1))
|
|
517
517
|
if match := _VERSION_PATTERN.search(text):
|
|
518
518
|
return parse_version(match.group(1))
|
|
519
519
|
if match := _YEAR_MONTH_PATTERN.search(text):
|
|
520
|
-
return YearMonth.
|
|
520
|
+
return YearMonth.parse_iso(match.group(1))
|
|
521
521
|
if match := _ZONED_DATE_TIME_PATTERN.search(text):
|
|
522
|
-
return ZonedDateTime.
|
|
522
|
+
return ZonedDateTime.parse_iso(match.group(1))
|
|
523
523
|
if match := _ZONED_DATE_TIME_PERIOD_PATTERN.search(text):
|
|
524
524
|
start, end = match.group(1).split(",")
|
|
525
|
-
end = ZonedDateTime.
|
|
526
|
-
start = PlainDateTime.
|
|
525
|
+
end = ZonedDateTime.parse_iso(end)
|
|
526
|
+
start = PlainDateTime.parse_iso(start).assume_tz(end.tz)
|
|
527
527
|
return ZonedDateTimePeriod(start, end)
|
|
528
528
|
if (
|
|
529
529
|
exc_class := _object_hook_exception_class(
|
utilities/parse.py
CHANGED
|
@@ -204,7 +204,7 @@ def _parse_object_type(
|
|
|
204
204
|
),
|
|
205
205
|
):
|
|
206
206
|
try:
|
|
207
|
-
return cls.
|
|
207
|
+
return cls.parse_iso(text)
|
|
208
208
|
except ValueError:
|
|
209
209
|
raise _ParseObjectParseError(type_=cls, text=text) from None
|
|
210
210
|
if issubclass(cls, Path):
|
|
@@ -477,7 +477,7 @@ def serialize_object(
|
|
|
477
477
|
ZonedDateTime,
|
|
478
478
|
),
|
|
479
479
|
):
|
|
480
|
-
return obj.
|
|
480
|
+
return obj.format_iso()
|
|
481
481
|
if isinstance(obj, Enum):
|
|
482
482
|
return obj.name
|
|
483
483
|
if isinstance(obj, dict):
|
utilities/pytest.py
CHANGED
|
@@ -299,7 +299,7 @@ def _skipif_recent(*, root: PathLike | None = None, delta: Delta = SECOND) -> No
|
|
|
299
299
|
except FileNotFoundError:
|
|
300
300
|
return
|
|
301
301
|
try:
|
|
302
|
-
last = ZonedDateTime.
|
|
302
|
+
last = ZonedDateTime.parse_iso(contents)
|
|
303
303
|
except ValueError:
|
|
304
304
|
return
|
|
305
305
|
now = get_now_local()
|
|
@@ -328,7 +328,7 @@ def _get_name() -> str:
|
|
|
328
328
|
def _write(root: PathLike | None = None, /) -> None:
|
|
329
329
|
path = _get_path(root)
|
|
330
330
|
with writer(path, overwrite=True) as temp:
|
|
331
|
-
_ = temp.write_text(get_now_local().
|
|
331
|
+
_ = temp.write_text(get_now_local().format_iso())
|
|
332
332
|
|
|
333
333
|
|
|
334
334
|
__all__ = [
|
utilities/timer.py
CHANGED
|
@@ -56,11 +56,11 @@ class Timer:
|
|
|
56
56
|
|
|
57
57
|
@override
|
|
58
58
|
def __repr__(self) -> str:
|
|
59
|
-
return self.timedelta.
|
|
59
|
+
return self.timedelta.format_iso()
|
|
60
60
|
|
|
61
61
|
@override
|
|
62
62
|
def __str__(self) -> str:
|
|
63
|
-
return self.timedelta.
|
|
63
|
+
return self.timedelta.format_iso()
|
|
64
64
|
|
|
65
65
|
# comparison
|
|
66
66
|
|
utilities/traceback.py
CHANGED
|
@@ -98,7 +98,7 @@ def _yield_header_lines(
|
|
|
98
98
|
yield f"Date/time | {format_compact(now)}"
|
|
99
99
|
start_use = to_zoned_date_time(start).to_tz(LOCAL_TIME_ZONE_NAME)
|
|
100
100
|
yield f"Started | {format_compact(start_use)}"
|
|
101
|
-
yield f"Duration | {(now - start_use).
|
|
101
|
+
yield f"Duration | {(now - start_use).format_iso()}"
|
|
102
102
|
yield f"User | {getuser()}"
|
|
103
103
|
yield f"Host | {gethostname()}"
|
|
104
104
|
yield f"Process ID | {getpid()}"
|
utilities/typed_settings.py
CHANGED
|
@@ -57,19 +57,19 @@ class ExtendedTSConverter(TSConverter):
|
|
|
57
57
|
) -> None:
|
|
58
58
|
super().__init__(resolve_paths=resolve_paths, strlist_sep=strlist_sep)
|
|
59
59
|
cases: list[_ConverterItem] = [
|
|
60
|
-
(Date, Date.
|
|
61
|
-
(DateDelta, DateDelta.
|
|
62
|
-
(DateTimeDelta, DateTimeDelta.
|
|
60
|
+
(Date, Date.parse_iso),
|
|
61
|
+
(DateDelta, DateDelta.parse_iso),
|
|
62
|
+
(DateTimeDelta, DateTimeDelta.parse_iso),
|
|
63
63
|
(IPv4Address, IPv4Address),
|
|
64
64
|
(IPv6Address, IPv6Address),
|
|
65
|
-
(MonthDay, MonthDay.
|
|
65
|
+
(MonthDay, MonthDay.parse_iso),
|
|
66
66
|
(Path, partial(_parse_path, resolve=resolve_paths, pwd=Path.cwd())),
|
|
67
|
-
(PlainDateTime, PlainDateTime.
|
|
68
|
-
(Time, Time.
|
|
69
|
-
(TimeDelta, TimeDelta.
|
|
67
|
+
(PlainDateTime, PlainDateTime.parse_iso),
|
|
68
|
+
(Time, Time.parse_iso),
|
|
69
|
+
(TimeDelta, TimeDelta.parse_iso),
|
|
70
70
|
(UUID, UUID),
|
|
71
|
-
(YearMonth, YearMonth.
|
|
72
|
-
(ZonedDateTime, ZonedDateTime.
|
|
71
|
+
(YearMonth, YearMonth.parse_iso),
|
|
72
|
+
(ZonedDateTime, ZonedDateTime.parse_iso),
|
|
73
73
|
*extra,
|
|
74
74
|
]
|
|
75
75
|
extras = {cls: _make_converter(cls, func) for cls, func in cases}
|
utilities/whenever.py
CHANGED
|
@@ -922,7 +922,7 @@ def to_date(
|
|
|
922
922
|
case None:
|
|
923
923
|
return get_today(time_zone)
|
|
924
924
|
case str():
|
|
925
|
-
return Date.
|
|
925
|
+
return Date.parse_iso(date)
|
|
926
926
|
case dt.date():
|
|
927
927
|
return Date.from_py_date(date)
|
|
928
928
|
case Callable() as func:
|
|
@@ -1505,7 +1505,7 @@ def to_time(
|
|
|
1505
1505
|
case None:
|
|
1506
1506
|
return get_time(time_zone)
|
|
1507
1507
|
case str():
|
|
1508
|
-
return Time.
|
|
1508
|
+
return Time.parse_iso(time)
|
|
1509
1509
|
case dt.time():
|
|
1510
1510
|
return Time.from_py_time(time)
|
|
1511
1511
|
case Callable() as func:
|
|
@@ -1733,7 +1733,7 @@ def to_zoned_date_time(
|
|
|
1733
1733
|
case None:
|
|
1734
1734
|
return get_now(UTC if time_zone is None else time_zone)
|
|
1735
1735
|
case str() as text:
|
|
1736
|
-
date_time_use = ZonedDateTime.
|
|
1736
|
+
date_time_use = ZonedDateTime.parse_iso(text.replace("~", "/"))
|
|
1737
1737
|
case dt.datetime() as py_date_time:
|
|
1738
1738
|
if isinstance(date_time.tzinfo, ZoneInfo):
|
|
1739
1739
|
py_date_time_use = py_date_time
|
|
@@ -1797,7 +1797,7 @@ class WheneverLogRecord(LogRecord):
|
|
|
1797
1797
|
name, level, pathname, lineno, msg, args, exc_info, func, sinfo
|
|
1798
1798
|
)
|
|
1799
1799
|
length = self._get_length()
|
|
1800
|
-
plain = format(get_now_local().to_plain().
|
|
1800
|
+
plain = format(get_now_local().to_plain().format_iso(), f"{length}s")
|
|
1801
1801
|
self.zoned_datetime = f"{plain}[{LOCAL_TIME_ZONE_NAME}]"
|
|
1802
1802
|
|
|
1803
1803
|
@classmethod
|
|
@@ -1805,7 +1805,7 @@ class WheneverLogRecord(LogRecord):
|
|
|
1805
1805
|
def _get_length(cls) -> int:
|
|
1806
1806
|
"""Get maximum length of a formatted string."""
|
|
1807
1807
|
now = get_now_local().replace(nanosecond=1000).to_plain()
|
|
1808
|
-
return len(now.
|
|
1808
|
+
return len(now.format_iso())
|
|
1809
1809
|
|
|
1810
1810
|
|
|
1811
1811
|
##
|
|
File without changes
|
|
File without changes
|
|
File without changes
|