dycw-utilities 0.138.12__py3-none-any.whl → 0.138.14__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.12.dist-info → dycw_utilities-0.138.14.dist-info}/METADATA +1 -1
- {dycw_utilities-0.138.12.dist-info → dycw_utilities-0.138.14.dist-info}/RECORD +7 -7
- utilities/__init__.py +1 -1
- utilities/whenever.py +51 -0
- {dycw_utilities-0.138.12.dist-info → dycw_utilities-0.138.14.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.138.12.dist-info → dycw_utilities-0.138.14.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.138.12.dist-info → dycw_utilities-0.138.14.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=cONkI_IFNfSqcsGihpBZx7cXfo2yNGxHqPOWbR64rSs,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
|
@@ -85,11 +85,11 @@ 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=WicmnXSFuZ64kemfULZGcV8Pt8-h6VBHJcObMHugSEo,22760
|
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.14.dist-info/METADATA,sha256=mFTnGB2iv53YtekLXrv-Zc1Zh1HVuwHpU9ZHrd30YXE,1639
|
92
|
+
dycw_utilities-0.138.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.138.14.dist-info/entry_points.txt,sha256=uLj5QWWVXv8tnMaRX3ZGYpt7w1xzLWU6LxbFhELEpkc,68
|
94
|
+
dycw_utilities-0.138.14.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
95
|
+
dycw_utilities-0.138.14.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/whenever.py
CHANGED
@@ -155,6 +155,34 @@ def datetime_utc(
|
|
155
155
|
##
|
156
156
|
|
157
157
|
|
158
|
+
@overload
|
159
|
+
def diff_year_month(
|
160
|
+
x: YearMonth, y: YearMonth, /, *, years: Literal[True]
|
161
|
+
) -> tuple[int, int]: ...
|
162
|
+
@overload
|
163
|
+
def diff_year_month(
|
164
|
+
x: YearMonth, y: YearMonth, /, *, years: Literal[False] = False
|
165
|
+
) -> int: ...
|
166
|
+
@overload
|
167
|
+
def diff_year_month(
|
168
|
+
x: YearMonth, y: YearMonth, /, *, years: bool = False
|
169
|
+
) -> int | tuple[int, int]: ...
|
170
|
+
def diff_year_month(
|
171
|
+
x: YearMonth, y: YearMonth, /, *, years: bool = False
|
172
|
+
) -> int | tuple[int, int]:
|
173
|
+
"""Compute the difference between two year-months."""
|
174
|
+
x_date, y_date = x.on_day(1), y.on_day(1)
|
175
|
+
diff = x_date - y_date
|
176
|
+
if years:
|
177
|
+
yrs, mth, _ = diff.in_years_months_days()
|
178
|
+
return yrs, mth
|
179
|
+
mth, _ = diff.in_months_days()
|
180
|
+
return mth
|
181
|
+
|
182
|
+
|
183
|
+
##
|
184
|
+
|
185
|
+
|
158
186
|
def format_compact(
|
159
187
|
obj: Date | Time | PlainDateTime | ZonedDateTime, /, *, fmt: str | None = None
|
160
188
|
) -> str:
|
@@ -552,6 +580,26 @@ def to_local_plain(date_time: ZonedDateTime, /) -> PlainDateTime:
|
|
552
580
|
##
|
553
581
|
|
554
582
|
|
583
|
+
def to_months(delta: DateDelta, /) -> int:
|
584
|
+
"""Compute the number of months in a date delta."""
|
585
|
+
months, days = delta.in_months_days()
|
586
|
+
if days != 0:
|
587
|
+
raise ToMonthsError(days=days)
|
588
|
+
return months
|
589
|
+
|
590
|
+
|
591
|
+
@dataclass(kw_only=True, slots=True)
|
592
|
+
class ToMonthsError(Exception):
|
593
|
+
days: int
|
594
|
+
|
595
|
+
@override
|
596
|
+
def __str__(self) -> str:
|
597
|
+
return f"Date delta must not contain days; got {self.days}"
|
598
|
+
|
599
|
+
|
600
|
+
##
|
601
|
+
|
602
|
+
|
555
603
|
def to_nanos(delta: DateTimeDelta, /) -> int:
|
556
604
|
"""Compute the number of nanoseconds in a date-time delta."""
|
557
605
|
try:
|
@@ -801,10 +849,12 @@ __all__ = [
|
|
801
849
|
"MeanDateTimeError",
|
802
850
|
"MinMaxDateError",
|
803
851
|
"ToDaysError",
|
852
|
+
"ToMonthsError",
|
804
853
|
"ToNanosError",
|
805
854
|
"ToPyTimeDeltaError",
|
806
855
|
"WheneverLogRecord",
|
807
856
|
"datetime_utc",
|
857
|
+
"diff_year_month",
|
808
858
|
"format_compact",
|
809
859
|
"from_timestamp",
|
810
860
|
"from_timestamp_millis",
|
@@ -819,6 +869,7 @@ __all__ = [
|
|
819
869
|
"to_date_time_delta",
|
820
870
|
"to_days",
|
821
871
|
"to_local_plain",
|
872
|
+
"to_months",
|
822
873
|
"to_nanos",
|
823
874
|
"to_py_time_delta",
|
824
875
|
"to_zoned_date_time",
|
File without changes
|
File without changes
|
File without changes
|