dycw-utilities 0.138.14__py3-none-any.whl → 0.138.16__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.14.dist-info → dycw_utilities-0.138.16.dist-info}/METADATA +1 -1
- {dycw_utilities-0.138.14.dist-info → dycw_utilities-0.138.16.dist-info}/RECORD +8 -8
- utilities/__init__.py +1 -1
- utilities/types.py +5 -0
- utilities/whenever.py +53 -1
- {dycw_utilities-0.138.14.dist-info → dycw_utilities-0.138.16.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.138.14.dist-info → dycw_utilities-0.138.16.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.138.14.dist-info → dycw_utilities-0.138.16.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=UL4hpBrSmrPmk3IahPJQKeqtiFq6zh3H6Bk-mMUlBc0,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=4ZzVB6IOT4vTUbI0-0TgPgnqZouiZaLzLORza2jEB3Q,24210
|
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.16.dist-info/METADATA,sha256=oiLhNbHe_C4E8EiVpOJkxjCsIBesSJHxhutHG7LVlQg,1639
|
92
|
+
dycw_utilities-0.138.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.138.16.dist-info/entry_points.txt,sha256=uLj5QWWVXv8tnMaRX3ZGYpt7w1xzLWU6LxbFhELEpkc,68
|
94
|
+
dycw_utilities-0.138.16.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
95
|
+
dycw_utilities-0.138.16.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,
|
@@ -621,7 +636,39 @@ class ToNanosError(Exception):
|
|
621
636
|
##
|
622
637
|
|
623
638
|
|
624
|
-
|
639
|
+
@overload
|
640
|
+
def to_py_date_or_date_time(date_or_date_time: Date, /) -> dt.date: ...
|
641
|
+
@overload
|
642
|
+
def to_py_date_or_date_time(date_or_date_time: ZonedDateTime, /) -> dt.datetime: ...
|
643
|
+
@overload
|
644
|
+
def to_py_date_or_date_time(date_or_date_time: None, /) -> None: ...
|
645
|
+
def to_py_date_or_date_time(
|
646
|
+
date_or_date_time: Date | ZonedDateTime | None, /
|
647
|
+
) -> dt.date | None:
|
648
|
+
"""Convert a Date or ZonedDateTime into a standard library equivalent."""
|
649
|
+
match date_or_date_time:
|
650
|
+
case Date() as date:
|
651
|
+
return date.py_date()
|
652
|
+
case ZonedDateTime() as date_time:
|
653
|
+
return date_time.py_datetime()
|
654
|
+
case None:
|
655
|
+
return None
|
656
|
+
case _ as never:
|
657
|
+
assert_never(never)
|
658
|
+
|
659
|
+
|
660
|
+
##
|
661
|
+
|
662
|
+
|
663
|
+
@overload
|
664
|
+
def to_py_time_delta(
|
665
|
+
delta: DateDelta | TimeDelta | DateTimeDelta, /
|
666
|
+
) -> dt.timedelta: ...
|
667
|
+
@overload
|
668
|
+
def to_py_time_delta(delta: None, /) -> None: ...
|
669
|
+
def to_py_time_delta(
|
670
|
+
delta: DateDelta | TimeDelta | DateTimeDelta | None, /
|
671
|
+
) -> dt.timedelta | None:
|
625
672
|
"""Try convert a DateDelta to a standard library timedelta."""
|
626
673
|
match delta:
|
627
674
|
case DateDelta():
|
@@ -636,6 +683,8 @@ def to_py_time_delta(delta: DateDelta | TimeDelta | DateTimeDelta, /) -> dt.time
|
|
636
683
|
return to_py_time_delta(delta.date_part()) + to_py_time_delta(
|
637
684
|
delta.time_part()
|
638
685
|
)
|
686
|
+
case None:
|
687
|
+
return None
|
639
688
|
case _ as never:
|
640
689
|
assert_never(never)
|
641
690
|
|
@@ -853,6 +902,7 @@ __all__ = [
|
|
853
902
|
"ToNanosError",
|
854
903
|
"ToPyTimeDeltaError",
|
855
904
|
"WheneverLogRecord",
|
905
|
+
"add_year_month",
|
856
906
|
"datetime_utc",
|
857
907
|
"diff_year_month",
|
858
908
|
"format_compact",
|
@@ -865,12 +915,14 @@ __all__ = [
|
|
865
915
|
"get_today_local",
|
866
916
|
"mean_datetime",
|
867
917
|
"min_max_date",
|
918
|
+
"sub_year_month",
|
868
919
|
"to_date",
|
869
920
|
"to_date_time_delta",
|
870
921
|
"to_days",
|
871
922
|
"to_local_plain",
|
872
923
|
"to_months",
|
873
924
|
"to_nanos",
|
925
|
+
"to_py_date_or_date_time",
|
874
926
|
"to_py_time_delta",
|
875
927
|
"to_zoned_date_time",
|
876
928
|
"two_digit_year_month",
|
File without changes
|
File without changes
|
File without changes
|