dycw-utilities 0.125.7__py3-none-any.whl → 0.125.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.125.7.dist-info → dycw_utilities-0.125.9.dist-info}/METADATA +1 -1
- {dycw_utilities-0.125.7.dist-info → dycw_utilities-0.125.9.dist-info}/RECORD +7 -7
- utilities/__init__.py +1 -1
- utilities/libcst.py +5 -2
- utilities/platform.py +29 -0
- {dycw_utilities-0.125.7.dist-info → dycw_utilities-0.125.9.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.125.7.dist-info → dycw_utilities-0.125.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=sL0f7a9_XSj0OxG9E_04onbu2cDKar7GrU1t0jU_9So,60
|
2
2
|
utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
|
3
3
|
utilities/asyncio.py,sha256=3OVbJKTYCucrIkM7WSMMkQA9jYJFCQMnGNM4H5rBNgA,29154
|
4
4
|
utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
|
@@ -28,7 +28,7 @@ utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
|
|
28
28
|
utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
|
29
29
|
utilities/iterables.py,sha256=wqq2lKfEAq1qncE-lR848DHX627aerFaq4BXmLen-NE,43589
|
30
30
|
utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
|
31
|
-
utilities/libcst.py,sha256=
|
31
|
+
utilities/libcst.py,sha256=L0IkwAWXPuNpYyceeJGOC8CAwHdVPRpbXC8MQphCXh4,4954
|
32
32
|
utilities/lightweight_charts.py,sha256=0xNfcsrgFI0R9xL25LtSm-W5yhfBI93qQNT6HyaXAhg,2769
|
33
33
|
utilities/logging.py,sha256=gwo3pusPjnWO1ollrtn1VKYyRAQJTue4SkCbMeNvec4,25715
|
34
34
|
utilities/loguru.py,sha256=MEMQVWrdECxk1e3FxGzmOf21vWT9j8CAir98SEXFKPA,3809
|
@@ -46,7 +46,7 @@ utilities/parse.py,sha256=vsZ2jf_ceSI_Kta9titixufysJaVXh0Whjz1T4awJZw,18938
|
|
46
46
|
utilities/pathlib.py,sha256=31WPMXdLIyXgYOMMl_HOI2wlo66MGSE-cgeelk-Lias,1410
|
47
47
|
utilities/period.py,sha256=o4wXYEXVlFomop4-Ra4L0yRP4i99NZFjIe_fa7NdZck,11024
|
48
48
|
utilities/pickle.py,sha256=Bhvd7cZl-zQKQDFjUerqGuSKlHvnW1K2QXeU5UZibtg,657
|
49
|
-
utilities/platform.py,sha256=
|
49
|
+
utilities/platform.py,sha256=48IOKx1IC6ZJXWG-b56ZQptITcNFhWRjELW72o2dGTA,2398
|
50
50
|
utilities/polars.py,sha256=QlmUpYTqHNkcLnWOQh1TW22W2QyLzvifCvBcbsqhpdE,63272
|
51
51
|
utilities/polars_ols.py,sha256=Uc9V5kvlWZ5cU93lKZ-cfAKdVFFw81tqwLW9PxtUvMs,5618
|
52
52
|
utilities/pqdm.py,sha256=foRytQybmOQ05pjt5LF7ANyzrIa--4ScDE3T2wd31a4,3118
|
@@ -88,7 +88,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
88
88
|
utilities/whenever.py,sha256=jS31ZAY5OMxFxLja_Yo5Fidi87Pd-GoVZ7Vi_teqVDA,16743
|
89
89
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
90
90
|
utilities/zoneinfo.py,sha256=-5j7IQ9nb7gR43rdgA7ms05im-XuqhAk9EJnQBXxCoQ,1874
|
91
|
-
dycw_utilities-0.125.
|
92
|
-
dycw_utilities-0.125.
|
93
|
-
dycw_utilities-0.125.
|
94
|
-
dycw_utilities-0.125.
|
91
|
+
dycw_utilities-0.125.9.dist-info/METADATA,sha256=Lr7FuRGFVTmBQl5RfJRKVA44Nz5TGMHeIKBv4Y4S5eY,12851
|
92
|
+
dycw_utilities-0.125.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.125.9.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
94
|
+
dycw_utilities-0.125.9.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/libcst.py
CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from collections.abc import Sequence
|
4
4
|
from dataclasses import dataclass
|
5
|
-
from subprocess import check_output
|
5
|
+
from subprocess import CalledProcessError, check_output
|
6
6
|
from typing import assert_never, override
|
7
7
|
|
8
8
|
from libcst import (
|
@@ -154,7 +154,10 @@ def render_module(source: str | Module, /) -> str:
|
|
154
154
|
"""Render a module."""
|
155
155
|
match source: # skipif-ci
|
156
156
|
case str() as text:
|
157
|
-
|
157
|
+
try:
|
158
|
+
return check_output(["ruff", "format", "-"], input=text, text=True)
|
159
|
+
except CalledProcessError:
|
160
|
+
return text
|
158
161
|
case Module() as module:
|
159
162
|
return render_module(module.code)
|
160
163
|
case _ as never:
|
utilities/platform.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
from dataclasses import dataclass
|
4
|
+
from pathlib import Path
|
4
5
|
from platform import system
|
5
6
|
from typing import TYPE_CHECKING, Literal, assert_never, override
|
6
7
|
|
@@ -42,6 +43,32 @@ IS_NOT_MAC = not IS_MAC
|
|
42
43
|
IS_NOT_LINUX = not IS_LINUX
|
43
44
|
|
44
45
|
|
46
|
+
##
|
47
|
+
|
48
|
+
|
49
|
+
def get_max_pid() -> int | None:
|
50
|
+
"""Get the maximum process ID."""
|
51
|
+
match SYSTEM:
|
52
|
+
case "windows": # pragma: no cover
|
53
|
+
return None
|
54
|
+
case "mac": # skipif-not-macos
|
55
|
+
return 99999
|
56
|
+
case "linux": # skipif-not-linux
|
57
|
+
try:
|
58
|
+
with Path("/proc/sys/kernel/pid_max").open() as fh:
|
59
|
+
return int(fh.read())
|
60
|
+
except FileNotFoundError: # pragma: no cover
|
61
|
+
return None
|
62
|
+
case _ as never:
|
63
|
+
assert_never(never)
|
64
|
+
|
65
|
+
|
66
|
+
MAX_PID = get_max_pid()
|
67
|
+
|
68
|
+
|
69
|
+
##
|
70
|
+
|
71
|
+
|
45
72
|
def maybe_yield_lower_case(text: Iterable[str], /) -> Iterator[str]:
|
46
73
|
"""Yield lower-cased text if the platform is case-insentive."""
|
47
74
|
match SYSTEM:
|
@@ -62,9 +89,11 @@ __all__ = [
|
|
62
89
|
"IS_NOT_MAC",
|
63
90
|
"IS_NOT_WINDOWS",
|
64
91
|
"IS_WINDOWS",
|
92
|
+
"MAX_PID",
|
65
93
|
"SYSTEM",
|
66
94
|
"GetSystemError",
|
67
95
|
"System",
|
96
|
+
"get_max_pid",
|
68
97
|
"get_system",
|
69
98
|
"maybe_yield_lower_case",
|
70
99
|
]
|
File without changes
|
File without changes
|