dycw-utilities 0.138.0__py3-none-any.whl → 0.138.2__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.0.dist-info → dycw_utilities-0.138.2.dist-info}/METADATA +1 -1
- {dycw_utilities-0.138.0.dist-info → dycw_utilities-0.138.2.dist-info}/RECORD +7 -7
- utilities/__init__.py +1 -1
- utilities/click.py +18 -1
- utilities/whenever.py +14 -0
- {dycw_utilities-0.138.0.dist-info → dycw_utilities-0.138.2.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.138.0.dist-info → dycw_utilities-0.138.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,11 +1,11 @@
|
|
1
|
-
utilities/__init__.py,sha256
|
1
|
+
utilities/__init__.py,sha256=rGNA-g7KeJXl2hGton-8NQ9cLlXVune9zy_gn79rBFU,60
|
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
|
5
5
|
utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
|
6
6
|
utilities/atools.py,sha256=9im2g8OCf-Iynqa8bAv8N0Ycj9QvrJmGO7yLCZEdgII,986
|
7
7
|
utilities/cachetools.py,sha256=v1-9sXHLdOLiwmkq6NB0OUbxeKBuVVN6wmAWefWoaHI,2744
|
8
|
-
utilities/click.py,sha256=
|
8
|
+
utilities/click.py,sha256=9kncXtPzRQ_23j06q0RJDvyOsR5KPoKRfbXHqiBKYxo,17492
|
9
9
|
utilities/concurrent.py,sha256=ZdhcNeBl1-HaAPY3h7bZ5ccuYdfdq2ATHplvZdnzlhk,2858
|
10
10
|
utilities/contextlib.py,sha256=lpaLJBy3X0UGLWjM98jkQZZq8so4fRmoK-Bheq0uOW4,1027
|
11
11
|
utilities/contextvars.py,sha256=RsSGGrbQqqZ67rOydnM7WWIsM2lIE31UHJLejnHJPWY,505
|
@@ -85,10 +85,10 @@ 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=R5d9UCNCdAOyjwLUmfH2Vn8Ykee8OHQi2skRTFfbZMM,20492
|
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.
|
91
|
+
dycw_utilities-0.138.2.dist-info/METADATA,sha256=6gn_JI5I-uywry5ZT3yIFP0t4wjcSyUNy6vosoP_rtI,1637
|
92
|
+
dycw_utilities-0.138.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.138.2.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
94
|
+
dycw_utilities-0.138.2.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/click.py
CHANGED
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, TypedDict, assert_never, override
|
|
8
8
|
import click
|
9
9
|
import whenever
|
10
10
|
from click import Choice, Context, Parameter, ParamType
|
11
|
-
from click.types import StringParamType
|
11
|
+
from click.types import IntParamType, StringParamType
|
12
12
|
|
13
13
|
import utilities.whenever
|
14
14
|
from utilities.enum import EnsureEnumError, ensure_enum
|
@@ -478,6 +478,14 @@ class FrozenSetEnums[E: enum.Enum](FrozenSetParameter[Enum[E], E]):
|
|
478
478
|
super().__init__(Enum(enum, case_sensitive=case_sensitive), separator=separator)
|
479
479
|
|
480
480
|
|
481
|
+
class FrozenSetInts(FrozenSetParameter[IntParamType, int]):
|
482
|
+
"""A frozenset-of-ints-valued parameter."""
|
483
|
+
|
484
|
+
@override
|
485
|
+
def __init__(self, *, separator: str = ",") -> None:
|
486
|
+
super().__init__(IntParamType(), separator=separator)
|
487
|
+
|
488
|
+
|
481
489
|
class FrozenSetStrs(FrozenSetParameter[StringParamType, str]):
|
482
490
|
"""A frozenset-of-strs-valued parameter."""
|
483
491
|
|
@@ -555,6 +563,14 @@ class ListEnums[E: enum.Enum](ListParameter[Enum[E], E]):
|
|
555
563
|
super().__init__(Enum(enum, case_sensitive=case_sensitive), separator=separator)
|
556
564
|
|
557
565
|
|
566
|
+
class ListInts(ListParameter[IntParamType, int]):
|
567
|
+
"""A list-of-ints-valued parameter."""
|
568
|
+
|
569
|
+
@override
|
570
|
+
def __init__(self, *, separator: str = ",") -> None:
|
571
|
+
super().__init__(IntParamType(), separator=separator)
|
572
|
+
|
573
|
+
|
558
574
|
class ListStrs(ListParameter[StringParamType, str]):
|
559
575
|
"""A list-of-strs-valued parameter."""
|
560
576
|
|
@@ -590,6 +606,7 @@ __all__ = [
|
|
590
606
|
"IPv6Address",
|
591
607
|
"ListChoices",
|
592
608
|
"ListEnums",
|
609
|
+
"ListInts",
|
593
610
|
"ListParameter",
|
594
611
|
"ListStrs",
|
595
612
|
"MonthDay",
|
utilities/whenever.py
CHANGED
@@ -25,6 +25,7 @@ from whenever import (
|
|
25
25
|
PlainDateTime,
|
26
26
|
Time,
|
27
27
|
TimeDelta,
|
28
|
+
YearMonth,
|
28
29
|
ZonedDateTime,
|
29
30
|
)
|
30
31
|
|
@@ -670,6 +671,18 @@ def to_zoned_date_time(
|
|
670
671
|
##
|
671
672
|
|
672
673
|
|
674
|
+
def two_digit_year_month(year: int, month: int, /) -> YearMonth:
|
675
|
+
"""Construct a year-month from a 2-digit year."""
|
676
|
+
min_year = DATE_TWO_DIGIT_YEAR_MIN.year
|
677
|
+
max_year = DATE_TWO_DIGIT_YEAR_MAX.year
|
678
|
+
years = range(min_year, max_year + 1)
|
679
|
+
(year_use,) = (y for y in years if y % 100 == year)
|
680
|
+
return YearMonth(year_use, month)
|
681
|
+
|
682
|
+
|
683
|
+
##
|
684
|
+
|
685
|
+
|
673
686
|
class WheneverLogRecord(LogRecord):
|
674
687
|
"""Log record powered by `whenever`."""
|
675
688
|
|
@@ -774,4 +787,5 @@ __all__ = [
|
|
774
787
|
"to_local_plain",
|
775
788
|
"to_nanos",
|
776
789
|
"to_zoned_date_time",
|
790
|
+
"two_digit_year_month",
|
777
791
|
]
|
File without changes
|
File without changes
|