dycw-utilities 0.166.4__py3-none-any.whl → 0.166.6__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.166.4
3
+ Version: 0.166.6
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -12,7 +12,7 @@ Provides-Extra: logging
12
12
  Requires-Dist: coloredlogs<15.1,>=15.0.1; extra == 'logging'
13
13
  Provides-Extra: test
14
14
  Requires-Dist: dycw-pytest-only<2.2,>=2.1.1; extra == 'test'
15
- Requires-Dist: hypothesis<6.139,>=6.138.6; extra == 'test'
15
+ Requires-Dist: hypothesis<6.139,>=6.138.8; extra == 'test'
16
16
  Requires-Dist: pytest-asyncio<1.2,>=1.1.0; extra == 'test'
17
17
  Requires-Dist: pytest-cov<6.3,>=6.2.1; extra == 'test'
18
18
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=s-Uh--xTi8lR5pU36QdYxFXLv1whLxgsm_xW8WJ9kEI,60
1
+ utilities/__init__.py,sha256=jnzehUZENuJc0jPB4e9Pclf6K2P3C9PnRF8pxKW7pSk,60
2
2
  utilities/aeventkit.py,sha256=ddoleSwW9zdc2tjX5Ge0pMKtYwV_JMxhHYOxnWX2AGM,12609
3
3
  utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
4
4
  utilities/asyncio.py,sha256=PUedzQ5deqlSECQ33sam9cRzI9TnygHz3FdOqWJWPTM,15288
@@ -74,7 +74,7 @@ utilities/text.py,sha256=NVPywVHGnHzyjs1N1U8J4YIqKCU3v-794y6c3px1wYo,13667
74
74
  utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
75
75
  utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
76
76
  utilities/traceback.py,sha256=b1nSvlyrGmI1MyZLkkoLVET3DQBSGt9qqIlAAQbyjEw,9629
77
- utilities/typed_settings.py,sha256=SFWqS3lAzV7IfNRwqFcTk0YynTcQ7BmrcW2mr_KUnos,4466
77
+ utilities/typed_settings.py,sha256=bCGybctbjNDEbUBCvQFhKitRFrk9ixImpvbIpshgbtA,4644
78
78
  utilities/types.py,sha256=IlRrCtPdLkGYVfpe-QIg2qNUgBr8OJNN7BhTKxnhh-M,18817
79
79
  utilities/typing.py,sha256=QYoCIc71e_u5W-kBeiNzrD-GXxpLtMOGc9PqgZjMXeE,25274
80
80
  utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
@@ -88,8 +88,8 @@ utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
88
88
  utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
89
89
  utilities/pytest_plugins/pytest_randomly.py,sha256=B1qYVlExGOxTywq2r1SMi5o7btHLk2PNdY_b1p98dkE,409
90
90
  utilities/pytest_plugins/pytest_regressions.py,sha256=9v8kAXDM2ycIXJBimoiF4EgrwbUvxTycFWJiGR_GHhM,1466
91
- dycw_utilities-0.166.4.dist-info/METADATA,sha256=iwjEa8xty7iVF7FfYcYGIwaflQWKn2XFMfUrvUFHxPk,1696
92
- dycw_utilities-0.166.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- dycw_utilities-0.166.4.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
- dycw_utilities-0.166.4.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
- dycw_utilities-0.166.4.dist-info/RECORD,,
91
+ dycw_utilities-0.166.6.dist-info/METADATA,sha256=gNHhNw7oKEF697GuPgRQuCeflcOuFFFnvUIRz0bdQyo,1696
92
+ dycw_utilities-0.166.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ dycw_utilities-0.166.6.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
+ dycw_utilities-0.166.6.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.166.6.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.166.4"
3
+ __version__ = "0.166.6"
@@ -30,7 +30,7 @@ from utilities.pathlib import to_path
30
30
  from utilities.string import substitute_environ
31
31
 
32
32
  if TYPE_CHECKING:
33
- from collections.abc import Callable
33
+ from collections.abc import Callable, Iterable
34
34
 
35
35
  from typed_settings.loaders import Loader
36
36
  from typed_settings.processors import Processor
@@ -38,6 +38,9 @@ if TYPE_CHECKING:
38
38
  from utilities.types import MaybeCallablePathLike, MaybeIterable, PathLike
39
39
 
40
40
 
41
+ type _ConverterItem = tuple[type[Any], Callable[..., Any]]
42
+
43
+
41
44
  ##
42
45
 
43
46
 
@@ -50,9 +53,10 @@ class ExtendedTSConverter(TSConverter):
50
53
  *,
51
54
  resolve_paths: bool = True,
52
55
  strlist_sep: str | Callable[[str], list] | None = ":",
56
+ extra: Iterable[_ConverterItem] = (),
53
57
  ) -> None:
54
58
  super().__init__(resolve_paths=resolve_paths, strlist_sep=strlist_sep)
55
- cases: list[tuple[type[Any], Callable[..., Any]]] = [
59
+ cases: list[_ConverterItem] = [
56
60
  (Date, Date.parse_common_iso),
57
61
  (DateDelta, DateDelta.parse_common_iso),
58
62
  (DateTimeDelta, DateTimeDelta.parse_common_iso),
@@ -66,6 +70,7 @@ class ExtendedTSConverter(TSConverter):
66
70
  (UUID, UUID),
67
71
  (YearMonth, YearMonth.parse_common_iso),
68
72
  (ZonedDateTime, ZonedDateTime.parse_common_iso),
73
+ *extra,
69
74
  ]
70
75
  extras = {cls: _make_converter(cls, func) for cls, func in cases}
71
76
  self.scalar_converters |= extras
@@ -113,6 +118,7 @@ def load_settings[T](
113
118
  start_dir: PathLike | None = None,
114
119
  loaders: MaybeIterable[Loader] | None = None,
115
120
  processors: MaybeIterable[Processor] = (),
121
+ converters: Iterable[_ConverterItem] = (),
116
122
  base_dir: Path = _BASE_DIR,
117
123
  ) -> T:
118
124
  if not search(r"^[A-Za-z]+(?:_[A-Za-z]+)*$", app_name):
@@ -129,7 +135,7 @@ def load_settings[T](
129
135
  cls,
130
136
  loaders_use,
131
137
  processors=list(always_iterable(processors)),
132
- converter=ExtendedTSConverter(),
138
+ converter=ExtendedTSConverter(extra=converters),
133
139
  base_dir=base_dir,
134
140
  )
135
141