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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.138.0
3
+ Version: 0.138.2
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,11 +1,11 @@
1
- utilities/__init__.py,sha256=-LD1QyR_P_VpkzFmNAkfoqYhCifIwYOuBQGhhpTr7lI,60
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=PToheYTcKmBwKOMHasZ36CKcMNmM005nKdvOCFUo5dw,16989
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=4K_DfnPvQ2iddgKmTd3aa1RT3ZTh3bU4R0xe41l9goI,20099
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.0.dist-info/METADATA,sha256=nExJGsgLn_Rn-_aeZ2risr4iR1Xuout7dLx9QEb8qbI,1637
92
- dycw_utilities-0.138.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- dycw_utilities-0.138.0.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
94
- dycw_utilities-0.138.0.dist-info/RECORD,,
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
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.138.0"
3
+ __version__ = "0.138.2"
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
  ]