dycw-utilities 0.138.13__py3-none-any.whl → 0.138.15__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.138.13.dist-info → dycw_utilities-0.138.15.dist-info}/METADATA +1 -1
- {dycw_utilities-0.138.13.dist-info → dycw_utilities-0.138.15.dist-info}/RECORD +8 -8
- utilities/__init__.py +1 -1
- utilities/types.py +5 -0
- utilities/whenever.py +46 -0
- {dycw_utilities-0.138.13.dist-info → dycw_utilities-0.138.15.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.138.13.dist-info → dycw_utilities-0.138.15.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.138.13.dist-info → dycw_utilities-0.138.15.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=truMbrEMkwTgWjlGtWBTO0md1YlF6g_-gFSBi6iu0N0,61
|
2
2
|
utilities/aiolimiter.py,sha256=mD0wEiqMgwpty4XTbawFpnkkmJS6R4JRsVXFUaoitSU,628
|
3
3
|
utilities/altair.py,sha256=HeZBVUocjkrTNwwKrClppsIqgNFF-ykv05HfZSoHYno,9104
|
4
4
|
utilities/asyncio.py,sha256=dcGeKQzjLBXxKzZkVIk5oZsFXEcynVbRB9iNB5XEDZk,38526
|
@@ -78,18 +78,18 @@ utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
|
78
78
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
79
79
|
utilities/traceback.py,sha256=YPD_MYNWc7k3vWF-YDWw4YUCZQyVR3ZLp6M1FAQR9Xw,8878
|
80
80
|
utilities/typed_settings.py,sha256=C2i2VK62us_Z5jjca9NLmDFiT3_mkoSCwgU6FDtDhMI,4501
|
81
|
-
utilities/types.py,sha256
|
81
|
+
utilities/types.py,sha256=WAdSOIGhnDOHIIggV8As8oOY9QrT06k3aIRC-yhgEH8,17489
|
82
82
|
utilities/typing.py,sha256=Z-_XDaWyT_6wIo3qfNK-hvRlzxP2Jxa9PgXzm5rDYRA,13790
|
83
83
|
utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
|
84
84
|
utilities/tzlocal.py,sha256=KyCXEgCTjqGFx-389JdTuhMRUaT06U1RCMdWoED-qro,728
|
85
85
|
utilities/uuid.py,sha256=32p7DGHGM2Btx6PcBvCZvERSWbpupMXqx6FppPoSoTU,612
|
86
86
|
utilities/version.py,sha256=ufhJMmI6KPs1-3wBI71aj5wCukd3sP_m11usLe88DNA,5117
|
87
87
|
utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
88
|
-
utilities/whenever.py,sha256=
|
88
|
+
utilities/whenever.py,sha256=Ftf-7neIyKjC_sGnQmFtac4BxPMNB547eHv4tenhwQo,23226
|
89
89
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
90
90
|
utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
|
91
|
-
dycw_utilities-0.138.
|
92
|
-
dycw_utilities-0.138.
|
93
|
-
dycw_utilities-0.138.
|
94
|
-
dycw_utilities-0.138.
|
95
|
-
dycw_utilities-0.138.
|
91
|
+
dycw_utilities-0.138.15.dist-info/METADATA,sha256=sO2p6FGX2-yznzkykDtCaS1X5ngWFddPkyE16Ho-36g,1639
|
92
|
+
dycw_utilities-0.138.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.138.15.dist-info/entry_points.txt,sha256=uLj5QWWVXv8tnMaRX3ZGYpt7w1xzLWU6LxbFhELEpkc,68
|
94
|
+
dycw_utilities-0.138.15.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
95
|
+
dycw_utilities-0.138.15.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/types.py
CHANGED
@@ -88,6 +88,10 @@ class Dataclass(Protocol):
|
|
88
88
|
__dataclass_fields__: ClassVar[dict[str, Any]]
|
89
89
|
|
90
90
|
|
91
|
+
# datetime
|
92
|
+
type MonthInt = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
93
|
+
|
94
|
+
|
91
95
|
# enum
|
92
96
|
type EnumLike[E: Enum] = MaybeStr[E]
|
93
97
|
|
@@ -270,6 +274,7 @@ __all__ = [
|
|
270
274
|
"MaybeStr",
|
271
275
|
"MaybeType",
|
272
276
|
"MonthDayLike",
|
277
|
+
"MonthInt",
|
273
278
|
"Number",
|
274
279
|
"OpenMode",
|
275
280
|
"OptExcInfo",
|
utilities/whenever.py
CHANGED
@@ -126,6 +126,21 @@ YEAR = DateDelta(years=1)
|
|
126
126
|
##
|
127
127
|
|
128
128
|
|
129
|
+
def add_year_month(x: YearMonth, /, *, years: int = 0, months: int = 0) -> YearMonth:
|
130
|
+
"""Add to a year-month."""
|
131
|
+
y = x.on_day(1) + DateDelta(years=years, months=months)
|
132
|
+
return y.year_month()
|
133
|
+
|
134
|
+
|
135
|
+
def sub_year_month(x: YearMonth, /, *, years: int = 0, months: int = 0) -> YearMonth:
|
136
|
+
"""Subtract from a year-month."""
|
137
|
+
y = x.on_day(1) - DateDelta(years=years, months=months)
|
138
|
+
return y.year_month()
|
139
|
+
|
140
|
+
|
141
|
+
##
|
142
|
+
|
143
|
+
|
129
144
|
def datetime_utc(
|
130
145
|
year: int,
|
131
146
|
month: int,
|
@@ -155,6 +170,34 @@ def datetime_utc(
|
|
155
170
|
##
|
156
171
|
|
157
172
|
|
173
|
+
@overload
|
174
|
+
def diff_year_month(
|
175
|
+
x: YearMonth, y: YearMonth, /, *, years: Literal[True]
|
176
|
+
) -> tuple[int, int]: ...
|
177
|
+
@overload
|
178
|
+
def diff_year_month(
|
179
|
+
x: YearMonth, y: YearMonth, /, *, years: Literal[False] = False
|
180
|
+
) -> int: ...
|
181
|
+
@overload
|
182
|
+
def diff_year_month(
|
183
|
+
x: YearMonth, y: YearMonth, /, *, years: bool = False
|
184
|
+
) -> int | tuple[int, int]: ...
|
185
|
+
def diff_year_month(
|
186
|
+
x: YearMonth, y: YearMonth, /, *, years: bool = False
|
187
|
+
) -> int | tuple[int, int]:
|
188
|
+
"""Compute the difference between two year-months."""
|
189
|
+
x_date, y_date = x.on_day(1), y.on_day(1)
|
190
|
+
diff = x_date - y_date
|
191
|
+
if years:
|
192
|
+
yrs, mth, _ = diff.in_years_months_days()
|
193
|
+
return yrs, mth
|
194
|
+
mth, _ = diff.in_months_days()
|
195
|
+
return mth
|
196
|
+
|
197
|
+
|
198
|
+
##
|
199
|
+
|
200
|
+
|
158
201
|
def format_compact(
|
159
202
|
obj: Date | Time | PlainDateTime | ZonedDateTime, /, *, fmt: str | None = None
|
160
203
|
) -> str:
|
@@ -825,7 +868,9 @@ __all__ = [
|
|
825
868
|
"ToNanosError",
|
826
869
|
"ToPyTimeDeltaError",
|
827
870
|
"WheneverLogRecord",
|
871
|
+
"add_year_month",
|
828
872
|
"datetime_utc",
|
873
|
+
"diff_year_month",
|
829
874
|
"format_compact",
|
830
875
|
"from_timestamp",
|
831
876
|
"from_timestamp_millis",
|
@@ -836,6 +881,7 @@ __all__ = [
|
|
836
881
|
"get_today_local",
|
837
882
|
"mean_datetime",
|
838
883
|
"min_max_date",
|
884
|
+
"sub_year_month",
|
839
885
|
"to_date",
|
840
886
|
"to_date_time_delta",
|
841
887
|
"to_days",
|
File without changes
|
File without changes
|
File without changes
|