dycw-utilities 0.133.3__py3-none-any.whl → 0.133.7__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.133.3
3
+ Version: 0.133.7
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -17,6 +17,7 @@ Requires-Dist: pytest-asyncio<1.1,>=1.0.0; extra == 'test'
17
17
  Requires-Dist: pytest-cov<6.2,>=6.1.1; extra == 'test'
18
18
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
19
19
  Requires-Dist: pytest-lazy-fixtures<1.2,>=1.1.4; extra == 'test'
20
+ Requires-Dist: pytest-randomly<3.17,>=3.16.0; extra == 'test'
20
21
  Requires-Dist: pytest-regressions<2.9,>=2.8.0; extra == 'test'
21
22
  Requires-Dist: pytest-rerunfailures<16,>=15.1; extra == 'test'
22
23
  Requires-Dist: pytest-rng<1.1,>=1.0.0; extra == 'test'
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=31YVB_AJgxQM_m4eKVmVRXjVsNiMYmbkxB7m4Pc6W2Y,60
1
+ utilities/__init__.py,sha256=xO1p3ztUBTb7zJNXCH2vHQC1E0YkICtZPG5eqgaFwhs,60
2
2
  utilities/aiolimiter.py,sha256=mD0wEiqMgwpty4XTbawFpnkkmJS6R4JRsVXFUaoitSU,628
3
3
  utilities/altair.py,sha256=HeZBVUocjkrTNwwKrClppsIqgNFF-ykv05HfZSoHYno,9104
4
4
  utilities/arq.py,sha256=objwVQZEmpX8XEtSdLB_Md_HY8VDEnT-_4Y_ujRy4NM,6498
@@ -6,7 +6,7 @@ utilities/asyncio.py,sha256=USWMMrHqPVRr20vlIn_n5JLimyqa-5xLhuqDYWJed8A,37586
6
6
  utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
7
7
  utilities/atools.py,sha256=-bFGIrwYMFR7xl39j02DZMsO_u5x5_Ph7bRlBUFVYyw,1048
8
8
  utilities/cachetools.py,sha256=uBtEv4hD-TuCPX_cQy1lOpLF-QqfwnYGSf0o4Soqydc,2826
9
- utilities/click.py,sha256=2k7Ss2qKwYb1JCDB5IWpNf-B2WTyjKR1GxDW-Y6anPs,15736
9
+ utilities/click.py,sha256=8oPW7-uE2z0gI1bJdgUu9U3ggx1UqfyZBGmhv1e-d-s,16249
10
10
  utilities/concurrent.py,sha256=s2scTEd2AhXVTW4hpASU2qxV_DiVLALfms55cCQzCvM,2886
11
11
  utilities/contextlib.py,sha256=lpaLJBy3X0UGLWjM98jkQZZq8so4fRmoK-Bheq0uOW4,1027
12
12
  utilities/contextvars.py,sha256=RsSGGrbQqqZ67rOydnM7WWIsM2lIE31UHJLejnHJPWY,505
@@ -79,7 +79,7 @@ utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
79
79
  utilities/timer.py,sha256=oYqRQ-G-DMOOHB6a4yP5-PJDVimLnbNkMnkOj_jUmFg,2474
80
80
  utilities/traceback.py,sha256=i-790AQbTrDA8MiYyOcYPFpm48I558VR_kL_7x4ypfY,8503
81
81
  utilities/typed_settings.py,sha256=io3bhnglxO5FRNuTz1vpgbbGgvyj6VGJ5pytPRUeJo4,3769
82
- utilities/types.py,sha256=ZvD16TobtB47IgMo2CK_CCdJsvhrTqAZgqgqbCME2T0,19223
82
+ utilities/types.py,sha256=-ql33onw3mp3nS6ZBXyE-g1uYEdGhoTJQcYOfatSNGI,19360
83
83
  utilities/typing.py,sha256=kVWK6ciV8T0MKxnFQcMSEr_XlRisspH5aBTTosMUh30,13872
84
84
  utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
85
85
  utilities/tzlocal.py,sha256=KyCXEgCTjqGFx-389JdTuhMRUaT06U1RCMdWoED-qro,728
@@ -89,7 +89,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
89
89
  utilities/whenever.py,sha256=A-yoOqBqrcVD1yDINDsTFDw7dq9-zgUGn_f8CxVUQJs,23332
90
90
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
91
91
  utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
92
- dycw_utilities-0.133.3.dist-info/METADATA,sha256=6ApLAv1jFj_CI0Xt9tOqqzT847UVPMwvS9Y9BqA5z64,1522
93
- dycw_utilities-0.133.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
94
- dycw_utilities-0.133.3.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
- dycw_utilities-0.133.3.dist-info/RECORD,,
92
+ dycw_utilities-0.133.7.dist-info/METADATA,sha256=AoTsqBJ2rcsoXsL_qxJtlZX9UKXz80JgEVThUtc5z28,1584
93
+ dycw_utilities-0.133.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
94
+ dycw_utilities-0.133.7.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.133.7.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.133.3"
3
+ __version__ = "0.133.7"
utilities/click.py CHANGED
@@ -148,9 +148,10 @@ class DateTimeDelta(ParamType):
148
148
  class Enum(ParamType, Generic[TEnum]):
149
149
  """An enum-valued parameter."""
150
150
 
151
+ @override
151
152
  def __init__(self, enum: type[TEnum], /, *, case_sensitive: bool = False) -> None:
152
153
  cls = get_class_name(enum)
153
- self.name = f"ENUM[{cls}]"
154
+ self.name = f"enum[{cls}]"
154
155
  self._enum = enum
155
156
  self._case_sensitive = case_sensitive
156
157
  super().__init__()
@@ -180,9 +181,11 @@ class Enum(ParamType, Generic[TEnum]):
180
181
  class Freq(ParamType):
181
182
  """An frequency-valued parameter."""
182
183
 
184
+ name = "freq"
185
+
183
186
  @override
184
187
  def __repr__(self) -> str:
185
- return "FREQ"
188
+ return self.name.upper()
186
189
 
187
190
  @override
188
191
  def convert(
@@ -383,16 +386,16 @@ class ZonedDateTime(ParamType):
383
386
  class FrozenSetParameter(ParamType, Generic[_TParam, _T]):
384
387
  """A frozenset-valued parameter."""
385
388
 
389
+ @override
386
390
  def __init__(self, param: _TParam, /, *, separator: str = ",") -> None:
387
- self.name = f"FROZENSET[{param.name}]"
391
+ self.name = f"frozenset[{param.name}]"
388
392
  self._param = param
389
393
  self._separator = separator
390
394
  super().__init__()
391
395
 
392
396
  @override
393
397
  def __repr__(self) -> str:
394
- desc = repr(self._param)
395
- return f"FROZENSET[{desc}]"
398
+ return f"FROZENSET[{self._param!r}]"
396
399
 
397
400
  @override
398
401
  def convert(
@@ -425,6 +428,7 @@ class FrozenSetParameter(ParamType, Generic[_TParam, _T]):
425
428
  class FrozenSetChoices(FrozenSetParameter[Choice, str]):
426
429
  """A frozenset-of-choices-valued parameter."""
427
430
 
431
+ @override
428
432
  def __init__(
429
433
  self,
430
434
  choices: Sequence[str],
@@ -441,6 +445,7 @@ class FrozenSetChoices(FrozenSetParameter[Choice, str]):
441
445
  class FrozenSetEnums(FrozenSetParameter[Enum[TEnum], TEnum]):
442
446
  """A frozenset-of-enums-valued parameter."""
443
447
 
448
+ @override
444
449
  def __init__(
445
450
  self,
446
451
  enum: type[TEnum],
@@ -455,6 +460,7 @@ class FrozenSetEnums(FrozenSetParameter[Enum[TEnum], TEnum]):
455
460
  class FrozenSetStrs(FrozenSetParameter[StringParamType, str]):
456
461
  """A frozenset-of-strs-valued parameter."""
457
462
 
463
+ @override
458
464
  def __init__(self, *, separator: str = ",") -> None:
459
465
  super().__init__(StringParamType(), separator=separator)
460
466
 
@@ -465,16 +471,16 @@ class FrozenSetStrs(FrozenSetParameter[StringParamType, str]):
465
471
  class ListParameter(ParamType, Generic[_TParam, _T]):
466
472
  """A list-valued parameter."""
467
473
 
474
+ @override
468
475
  def __init__(self, param: _TParam, /, *, separator: str = ",") -> None:
469
- self.name = f"LIST[{param.name}]"
476
+ self.name = f"list[{param.name}]"
470
477
  self._param = param
471
478
  self._separator = separator
472
479
  super().__init__()
473
480
 
474
481
  @override
475
482
  def __repr__(self) -> str:
476
- desc = repr(self._param)
477
- return f"LIST[{desc}]"
483
+ return f"LIST[{self._param!r}]"
478
484
 
479
485
  @override
480
486
  def convert(
@@ -504,9 +510,27 @@ class ListParameter(ParamType, Generic[_TParam, _T]):
504
510
  return _make_metavar(param, desc)
505
511
 
506
512
 
513
+ class ListChoices(ListParameter[Choice, str]):
514
+ """A frozenset-of-choices-valued parameter."""
515
+
516
+ @override
517
+ def __init__(
518
+ self,
519
+ choices: Sequence[str],
520
+ /,
521
+ *,
522
+ case_sensitive: bool = False,
523
+ separator: str = ",",
524
+ ) -> None:
525
+ super().__init__(
526
+ Choice(choices, case_sensitive=case_sensitive), separator=separator
527
+ )
528
+
529
+
507
530
  class ListEnums(ListParameter[Enum[TEnum], TEnum]):
508
531
  """A list-of-enums-valued parameter."""
509
532
 
533
+ @override
510
534
  def __init__(
511
535
  self,
512
536
  enum: type[TEnum],
@@ -521,6 +545,7 @@ class ListEnums(ListParameter[Enum[TEnum], TEnum]):
521
545
  class ListStrs(ListParameter[StringParamType, str]):
522
546
  """A list-of-strs-valued parameter."""
523
547
 
548
+ @override
524
549
  def __init__(self, *, separator: str = ",") -> None:
525
550
  super().__init__(StringParamType(), separator=separator)
526
551
 
@@ -550,6 +575,7 @@ __all__ = [
550
575
  "FrozenSetStrs",
551
576
  "IPv4Address",
552
577
  "IPv6Address",
578
+ "ListChoices",
553
579
  "ListEnums",
554
580
  "ListParameter",
555
581
  "ListStrs",
utilities/types.py CHANGED
@@ -82,6 +82,9 @@ TCallable2 = TypeVar("TCallable2", bound=Callable[..., Any])
82
82
  TCallableCoroutine1 = TypeVar(
83
83
  "TCallableCoroutine1", bound=Callable[..., Coroutine1[Any]]
84
84
  )
85
+ TCallableCoroutine1None = TypeVar(
86
+ "TCallableCoroutine1None", bound=Callable[..., Coroutine1[None]]
87
+ )
85
88
  TCallableMaybeCoroutine1None = TypeVar(
86
89
  "TCallableMaybeCoroutine1None", bound=Callable[..., MaybeCoroutine1[None]]
87
90
  )
@@ -352,6 +355,7 @@ __all__ = [
352
355
  "TCallable1",
353
356
  "TCallable2",
354
357
  "TCallableCoroutine1",
358
+ "TCallableCoroutine1None",
355
359
  "TCallableMaybeCoroutine1None",
356
360
  "TDataclass",
357
361
  "TEnum",