dycw-utilities 0.136.8__py3-none-any.whl → 0.136.9__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.136.8.dist-info → dycw_utilities-0.136.9.dist-info}/METADATA +1 -1
- {dycw_utilities-0.136.8.dist-info → dycw_utilities-0.136.9.dist-info}/RECORD +6 -6
- utilities/__init__.py +1 -1
- utilities/typed_settings.py +20 -2
- {dycw_utilities-0.136.8.dist-info → dycw_utilities-0.136.9.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.136.8.dist-info → dycw_utilities-0.136.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=TfRJ5LJDqhQMm2y-jbpj1oPenJALJoqsiY7i5XiMjcE,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
|
@@ -77,7 +77,7 @@ utilities/text.py,sha256=ymBFlP_cA8OgNnZRVNs7FAh7OG8HxE6YkiLEMZv5g_A,11297
|
|
77
77
|
utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
78
78
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
79
79
|
utilities/traceback.py,sha256=YvNUQCTDLvrKYAsl5498a0zhfjJna0dEUvIaK7PmLlQ,8780
|
80
|
-
utilities/typed_settings.py,sha256=
|
80
|
+
utilities/typed_settings.py,sha256=cZqA2IjG1erF1SUZFSsjIHmZX7BP5iIfPd6CixHllA0,4367
|
81
81
|
utilities/types.py,sha256=98pwEfkBikg6UUrshNJZgc8l97FGBbi0twIsqVt-KNA,17247
|
82
82
|
utilities/typing.py,sha256=Z-_XDaWyT_6wIo3qfNK-hvRlzxP2Jxa9PgXzm5rDYRA,13790
|
83
83
|
utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
|
@@ -88,7 +88,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
88
88
|
utilities/whenever.py,sha256=A-yoOqBqrcVD1yDINDsTFDw7dq9-zgUGn_f8CxVUQJs,23332
|
89
89
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
90
90
|
utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
|
91
|
-
dycw_utilities-0.136.
|
92
|
-
dycw_utilities-0.136.
|
93
|
-
dycw_utilities-0.136.
|
94
|
-
dycw_utilities-0.136.
|
91
|
+
dycw_utilities-0.136.9.dist-info/METADATA,sha256=MOcxHEd2C4kHuMPGAw3BKehTyJMq0qejj7XF1I3KYYc,1637
|
92
|
+
dycw_utilities-0.136.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.136.9.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
94
|
+
dycw_utilities-0.136.9.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/typed_settings.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
from dataclasses import dataclass
|
4
|
+
from functools import partial
|
4
5
|
from ipaddress import IPv4Address, IPv6Address
|
6
|
+
from os import environ
|
5
7
|
from pathlib import Path
|
6
8
|
from re import search
|
7
|
-
from typing import TYPE_CHECKING, Any, override
|
9
|
+
from typing import TYPE_CHECKING, Any, assert_never, override
|
8
10
|
|
9
11
|
import typed_settings
|
10
12
|
from typed_settings import EnvLoader, FileLoader, find
|
@@ -21,6 +23,8 @@ from whenever import (
|
|
21
23
|
)
|
22
24
|
|
23
25
|
from utilities.iterables import always_iterable
|
26
|
+
from utilities.pathlib import get_path
|
27
|
+
from utilities.string import substitute_environ
|
24
28
|
from utilities.whenever import Freq
|
25
29
|
|
26
30
|
if TYPE_CHECKING:
|
@@ -29,7 +33,7 @@ if TYPE_CHECKING:
|
|
29
33
|
from typed_settings.loaders import Loader
|
30
34
|
from typed_settings.processors import Processor
|
31
35
|
|
32
|
-
from utilities.types import MaybeIterable, PathLike
|
36
|
+
from utilities.types import MaybeCallablePathLike, MaybeIterable, PathLike
|
33
37
|
|
34
38
|
|
35
39
|
##
|
@@ -53,6 +57,7 @@ class ExtendedTSConverter(TSConverter):
|
|
53
57
|
(Freq, Freq.parse),
|
54
58
|
(IPv4Address, IPv4Address),
|
55
59
|
(IPv6Address, IPv6Address),
|
60
|
+
(Path, partial(_parse_path, resolve=resolve_paths, pwd=Path.cwd())),
|
56
61
|
(PlainDateTime, PlainDateTime.parse_common_iso),
|
57
62
|
(Time, Time.parse_common_iso),
|
58
63
|
(TimeDelta, TimeDelta.parse_common_iso),
|
@@ -76,6 +81,19 @@ def _make_converter[T](
|
|
76
81
|
return hook
|
77
82
|
|
78
83
|
|
84
|
+
def _parse_path(
|
85
|
+
path: str, /, *, resolve: bool = False, pwd: MaybeCallablePathLike | None = None
|
86
|
+
) -> Path:
|
87
|
+
path = substitute_environ(path, **environ)
|
88
|
+
match resolve:
|
89
|
+
case True:
|
90
|
+
return get_path(path=pwd).joinpath(path).resolve()
|
91
|
+
case False:
|
92
|
+
return Path(path)
|
93
|
+
case _ as never:
|
94
|
+
assert_never(never)
|
95
|
+
|
96
|
+
|
79
97
|
##
|
80
98
|
|
81
99
|
_BASE_DIR: Path = Path()
|
File without changes
|
File without changes
|