dycw-utilities 0.129.12__py3-none-any.whl → 0.129.14__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.129.12.dist-info → dycw_utilities-0.129.14.dist-info}/METADATA +1 -1
- {dycw_utilities-0.129.12.dist-info → dycw_utilities-0.129.14.dist-info}/RECORD +7 -6
- utilities/__init__.py +1 -1
- utilities/inflect.py +17 -0
- utilities/pathlib.py +12 -1
- {dycw_utilities-0.129.12.dist-info → dycw_utilities-0.129.14.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.129.12.dist-info → dycw_utilities-0.129.14.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=Y_ehKmi3nnT-vHTNDhutElTH0U818iyI5Sgkr2YVx-Q,61
|
2
2
|
utilities/aiolimiter.py,sha256=mD0wEiqMgwpty4XTbawFpnkkmJS6R4JRsVXFUaoitSU,628
|
3
3
|
utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
|
4
4
|
utilities/asyncio.py,sha256=3n5EIcSq2xtEF1i4oR0oY2JmBq3NyugeHKFK39Mt22s,37987
|
@@ -26,6 +26,7 @@ utilities/hashlib.py,sha256=SVTgtguur0P4elppvzOBbLEjVM3Pea0eWB61yg2ilxo,309
|
|
26
26
|
utilities/http.py,sha256=WcahTcKYRtZ04WXQoWt5EGCgFPcyHD3EJdlMfxvDt-0,946
|
27
27
|
utilities/hypothesis.py,sha256=UnUMJmeqwJuK7uyUqw_i3opUYzVKud4RMG0RMOSRBQY,44463
|
28
28
|
utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
|
29
|
+
utilities/inflect.py,sha256=DbqB5Q9FbRGJ1NbvEiZBirRMxCxgrz91zy5jCO9ZIs0,347
|
29
30
|
utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
|
30
31
|
utilities/iterables.py,sha256=mDqw2_0MUVp-P8FklgcaVTi2TXduH0MxbhTDzzhSBho,44915
|
31
32
|
utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
|
@@ -44,7 +45,7 @@ utilities/optuna.py,sha256=loyJGWTzljgdJaoLhP09PT8Jz6o_pwBOwehY33lHkhw,1923
|
|
44
45
|
utilities/orjson.py,sha256=AvPFxzJdxC-3PBID3cqdiMyN8FeC7aW9QUgGwbvKuAM,36948
|
45
46
|
utilities/os.py,sha256=D_FyyT-6TtqiN9KSS7c9g1fnUtgxmyMtzAjmYLkk46A,3587
|
46
47
|
utilities/parse.py,sha256=vsZ2jf_ceSI_Kta9titixufysJaVXh0Whjz1T4awJZw,18938
|
47
|
-
utilities/pathlib.py,sha256=
|
48
|
+
utilities/pathlib.py,sha256=PK41rf1c9Wqv7h8f5R7H3_Lhq_gQZTUJD5tu3gMHVaU,3247
|
48
49
|
utilities/period.py,sha256=o4wXYEXVlFomop4-Ra4L0yRP4i99NZFjIe_fa7NdZck,11024
|
49
50
|
utilities/pickle.py,sha256=Bhvd7cZl-zQKQDFjUerqGuSKlHvnW1K2QXeU5UZibtg,657
|
50
51
|
utilities/platform.py,sha256=48IOKx1IC6ZJXWG-b56ZQptITcNFhWRjELW72o2dGTA,2398
|
@@ -91,7 +92,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
91
92
|
utilities/whenever.py,sha256=QbXgFAPuUL7PCp2hajmIP-FFIfIR1J6Y0TxJbeoj60I,18434
|
92
93
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
93
94
|
utilities/zoneinfo.py,sha256=-5j7IQ9nb7gR43rdgA7ms05im-XuqhAk9EJnQBXxCoQ,1874
|
94
|
-
dycw_utilities-0.129.
|
95
|
-
dycw_utilities-0.129.
|
96
|
-
dycw_utilities-0.129.
|
97
|
-
dycw_utilities-0.129.
|
95
|
+
dycw_utilities-0.129.14.dist-info/METADATA,sha256=FPFxke4KtPpdpvY4nb_JGWGKVDehcRi3Ap6gjMYC_sk,13084
|
96
|
+
dycw_utilities-0.129.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
97
|
+
dycw_utilities-0.129.14.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
98
|
+
dycw_utilities-0.129.14.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/inflect.py
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import cast
|
4
|
+
|
5
|
+
from inflect import Word, engine
|
6
|
+
|
7
|
+
_ENGINE = engine()
|
8
|
+
|
9
|
+
|
10
|
+
def counted_noun(num: int, noun: str, /) -> str:
|
11
|
+
"""Construct a counted noun."""
|
12
|
+
word = cast("Word", noun)
|
13
|
+
sin_or_plu = _ENGINE.plural_noun(word, count=num)
|
14
|
+
return f"{num} {sin_or_plu}"
|
15
|
+
|
16
|
+
|
17
|
+
__all__ = ["counted_noun"]
|
utilities/pathlib.py
CHANGED
@@ -5,6 +5,7 @@ from contextlib import contextmanager, suppress
|
|
5
5
|
from dataclasses import dataclass
|
6
6
|
from itertools import chain
|
7
7
|
from os import chdir
|
8
|
+
from os.path import expandvars
|
8
9
|
from pathlib import Path
|
9
10
|
from re import IGNORECASE, search
|
10
11
|
from subprocess import PIPE, CalledProcessError, check_output
|
@@ -34,6 +35,16 @@ def ensure_suffix(path: PathLike, suffix: str, /) -> Path:
|
|
34
35
|
##
|
35
36
|
|
36
37
|
|
38
|
+
def expand_path(path: PathLike, /) -> Path:
|
39
|
+
"""Expand a path."""
|
40
|
+
path = str(path)
|
41
|
+
path = expandvars(path)
|
42
|
+
return Path(path).expanduser()
|
43
|
+
|
44
|
+
|
45
|
+
##
|
46
|
+
|
47
|
+
|
37
48
|
@overload
|
38
49
|
def get_path(*, path: MaybeCallablePathLike | None) -> Path: ...
|
39
50
|
@overload
|
@@ -111,4 +122,4 @@ def temp_cwd(path: PathLike, /) -> Iterator[None]:
|
|
111
122
|
chdir(prev)
|
112
123
|
|
113
124
|
|
114
|
-
__all__ = ["PWD", "ensure_suffix", "get_path", "list_dir", "temp_cwd"]
|
125
|
+
__all__ = ["PWD", "ensure_suffix", "expand_path", "get_path", "list_dir", "temp_cwd"]
|
File without changes
|
File without changes
|