dycw-utilities 0.131.19__py3-none-any.whl → 0.131.20__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.
- {dycw_utilities-0.131.19.dist-info → dycw_utilities-0.131.20.dist-info}/METADATA +1 -1
- {dycw_utilities-0.131.19.dist-info → dycw_utilities-0.131.20.dist-info}/RECORD +8 -8
- utilities/__init__.py +1 -1
- utilities/datetime.py +1 -18
- utilities/platform.py +18 -0
- utilities/whenever2.py +2 -2
- {dycw_utilities-0.131.19.dist-info → dycw_utilities-0.131.20.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.131.19.dist-info → dycw_utilities-0.131.20.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=GCEBNdMoh_0RICTyJLGe9jYZmY5kt76qHaBpjsznMNc,61
|
2
2
|
utilities/aiolimiter.py,sha256=mD0wEiqMgwpty4XTbawFpnkkmJS6R4JRsVXFUaoitSU,628
|
3
3
|
utilities/altair.py,sha256=HeZBVUocjkrTNwwKrClppsIqgNFF-ykv05HfZSoHYno,9104
|
4
4
|
utilities/asyncio.py,sha256=mHnlSA4KPeDaBRts8Rn4sNA_4urodj7gQzs-_8Z-F7A,37587
|
@@ -12,7 +12,7 @@ utilities/contextvars.py,sha256=RsSGGrbQqqZ67rOydnM7WWIsM2lIE31UHJLejnHJPWY,505
|
|
12
12
|
utilities/cryptography.py,sha256=_CiK_K6c_-uQuUhsUNjNjTL-nqxAh4_1zTfS11Xe120,972
|
13
13
|
utilities/cvxpy.py,sha256=Rv1-fD-XYerosCavRF8Pohop2DBkU3AlFaGTfD8AEAA,13776
|
14
14
|
utilities/dataclasses.py,sha256=iiC1wpGXWhaocIikzwBt8bbLWyImoUlOlcDZJGejaIg,33011
|
15
|
-
utilities/datetime.py,sha256=
|
15
|
+
utilities/datetime.py,sha256=awFnwPswr6kfi76Y4AtOLxiNyV7HtURQS8NYUGe5Jz8,5308
|
16
16
|
utilities/enum.py,sha256=HoRwVCWzsnH0vpO9ZEcAAIZLMv0Sn2vJxxA4sYMQgDs,5793
|
17
17
|
utilities/errors.py,sha256=nC7ZYtxxDBMfrTHtT_MByBfup_wfGQFRo3eDt-0ZPe8,1045
|
18
18
|
utilities/eventkit.py,sha256=6M5Xu1SzN-juk9PqBHwy5dS-ta7T0qA6SMpDsakOJ0E,13039
|
@@ -47,7 +47,7 @@ utilities/parse.py,sha256=YE2VWYKDm9WYf5wcOWrOxVfM6UWvhkSxSkwdxRQNsA0,17633
|
|
47
47
|
utilities/pathlib.py,sha256=PK41rf1c9Wqv7h8f5R7H3_Lhq_gQZTUJD5tu3gMHVaU,3247
|
48
48
|
utilities/period.py,sha256=opqpBevBGSGXbA7NYfRJjtthi1JPxdMaZ7QV3xosnTc,4774
|
49
49
|
utilities/pickle.py,sha256=MBT2xZCsv0pH868IXLGKnlcqNx2IRVKYNpRcqiQQqxw,653
|
50
|
-
utilities/platform.py,sha256=
|
50
|
+
utilities/platform.py,sha256=5uCKRf_ij7ukJDcbnNfhY2ay9fbrpiNLRO1t2QvcwqQ,2825
|
51
51
|
utilities/polars.py,sha256=BYTYniVSW9SrBWdmoTy8RqUgqBW4y07mlRPEWXPUyYg,63357
|
52
52
|
utilities/polars_ols.py,sha256=Uc9V5kvlWZ5cU93lKZ-cfAKdVFFw81tqwLW9PxtUvMs,5618
|
53
53
|
utilities/pottery.py,sha256=2w3YuoH1KmLaCVqkwSghHTOT8S4xiUskwRHSRqrUEQY,3430
|
@@ -87,10 +87,10 @@ utilities/tzlocal.py,sha256=xbBBzVIUKMk8AkhuIp1qxGRNBioIa5I09dpeoBnIOOU,662
|
|
87
87
|
utilities/uuid.py,sha256=jJTFxz-CWgltqNuzmythB7iEQ-Q1mCwPevUfKthZT3c,611
|
88
88
|
utilities/version.py,sha256=ufhJMmI6KPs1-3wBI71aj5wCukd3sP_m11usLe88DNA,5117
|
89
89
|
utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
90
|
-
utilities/whenever2.py,sha256=
|
90
|
+
utilities/whenever2.py,sha256=SQlzUvFwyp5ryrnM0RBID42DP3ZOpDWCIGnJEIlgs3A,15700
|
91
91
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
92
92
|
utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
|
93
|
-
dycw_utilities-0.131.
|
94
|
-
dycw_utilities-0.131.
|
95
|
-
dycw_utilities-0.131.
|
96
|
-
dycw_utilities-0.131.
|
93
|
+
dycw_utilities-0.131.20.dist-info/METADATA,sha256=J7vX8iiLxsQw1lU0a9zTpnescNR9wMS4CUEpDSU50Pg,1585
|
94
|
+
dycw_utilities-0.131.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
95
|
+
dycw_utilities-0.131.20.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
96
|
+
dycw_utilities-0.131.20.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/datetime.py
CHANGED
@@ -2,11 +2,10 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import datetime as dt
|
4
4
|
from dataclasses import dataclass, replace
|
5
|
-
from re import search
|
5
|
+
from re import search
|
6
6
|
from typing import Any, Self, assert_never, overload, override
|
7
7
|
|
8
8
|
from utilities.iterables import OneEmptyError, one
|
9
|
-
from utilities.platform import SYSTEM
|
10
9
|
from utilities.types import MaybeStr
|
11
10
|
from utilities.zoneinfo import UTC
|
12
11
|
|
@@ -41,22 +40,6 @@ class EnsureMonthError(Exception):
|
|
41
40
|
##
|
42
41
|
|
43
42
|
|
44
|
-
def maybe_sub_pct_y(text: str, /) -> str:
|
45
|
-
"""Substitute the `%Y' token with '%4Y' if necessary."""
|
46
|
-
match SYSTEM:
|
47
|
-
case "windows": # skipif-not-windows
|
48
|
-
return text
|
49
|
-
case "mac": # skipif-not-macos
|
50
|
-
return text
|
51
|
-
case "linux": # skipif-not-linux
|
52
|
-
return sub("%Y", "%4Y", text)
|
53
|
-
case _ as never:
|
54
|
-
assert_never(never)
|
55
|
-
|
56
|
-
|
57
|
-
##
|
58
|
-
|
59
|
-
|
60
43
|
@dataclass(order=True, unsafe_hash=True, slots=True)
|
61
44
|
class Month:
|
62
45
|
"""Represents a month in time."""
|
utilities/platform.py
CHANGED
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
from dataclasses import dataclass
|
4
4
|
from pathlib import Path
|
5
5
|
from platform import system
|
6
|
+
from re import sub
|
6
7
|
from typing import TYPE_CHECKING, Literal, assert_never, override
|
7
8
|
|
8
9
|
if TYPE_CHECKING:
|
@@ -69,6 +70,22 @@ MAX_PID = get_max_pid()
|
|
69
70
|
##
|
70
71
|
|
71
72
|
|
73
|
+
def get_strftime(text: str, /) -> str:
|
74
|
+
"""Get a platform-specific format string."""
|
75
|
+
match SYSTEM:
|
76
|
+
case "windows": # skipif-not-windows
|
77
|
+
return text
|
78
|
+
case "mac": # skipif-not-macos
|
79
|
+
return text
|
80
|
+
case "linux": # skipif-not-linux
|
81
|
+
return sub("%Y", "%4Y", text)
|
82
|
+
case _ as never:
|
83
|
+
assert_never(never)
|
84
|
+
|
85
|
+
|
86
|
+
##
|
87
|
+
|
88
|
+
|
72
89
|
def maybe_yield_lower_case(text: Iterable[str], /) -> Iterator[str]:
|
73
90
|
"""Yield lower-cased text if the platform is case-insentive."""
|
74
91
|
match SYSTEM:
|
@@ -94,6 +111,7 @@ __all__ = [
|
|
94
111
|
"GetSystemError",
|
95
112
|
"System",
|
96
113
|
"get_max_pid",
|
114
|
+
"get_strftime",
|
97
115
|
"get_system",
|
98
116
|
"maybe_yield_lower_case",
|
99
117
|
]
|
utilities/whenever2.py
CHANGED
@@ -18,8 +18,8 @@ from whenever import (
|
|
18
18
|
ZonedDateTime,
|
19
19
|
)
|
20
20
|
|
21
|
-
from utilities.datetime import maybe_sub_pct_y
|
22
21
|
from utilities.math import sign
|
22
|
+
from utilities.platform import get_strftime
|
23
23
|
from utilities.sentinel import Sentinel, sentinel
|
24
24
|
from utilities.tzlocal import LOCAL_TIME_ZONE, LOCAL_TIME_ZONE_NAME
|
25
25
|
from utilities.zoneinfo import UTC, get_time_zone_name
|
@@ -148,7 +148,7 @@ def datetime_utc(
|
|
148
148
|
def format_compact(datetime: ZonedDateTime, /) -> str:
|
149
149
|
"""Convert a zoned datetime to the local time zone, then format."""
|
150
150
|
py_datetime = datetime.round().to_tz(LOCAL_TIME_ZONE_NAME).to_plain().py_datetime()
|
151
|
-
return py_datetime.strftime(
|
151
|
+
return py_datetime.strftime(get_strftime("%Y%m%dT%H%M%S"))
|
152
152
|
|
153
153
|
|
154
154
|
##
|
File without changes
|
File without changes
|