dycw-utilities 0.149.6__py3-none-any.whl → 0.149.8__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.149.6.dist-info → dycw_utilities-0.149.8.dist-info}/METADATA +1 -1
- {dycw_utilities-0.149.6.dist-info → dycw_utilities-0.149.8.dist-info}/RECORD +8 -8
- utilities/__init__.py +1 -1
- utilities/pottery.py +15 -4
- utilities/tempfile.py +26 -3
- {dycw_utilities-0.149.6.dist-info → dycw_utilities-0.149.8.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.149.6.dist-info → dycw_utilities-0.149.8.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.149.6.dist-info → dycw_utilities-0.149.8.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=Mf4foS-np1iwUCHqRFsn8rDza6YFtUS6QuzGZs1-8EE,60
|
2
2
|
utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
|
3
3
|
utilities/asyncio.py,sha256=z0w3fb-U5Ml5YXVaFFPClizXaQmjDO6YgZg-V9QL0VQ,16021
|
4
4
|
utilities/atomicwrites.py,sha256=xcOWenTBRS0oat3kg7Sqe51AohNThMQ2ixPL7QCG8hw,5795
|
@@ -50,7 +50,7 @@ utilities/platform.py,sha256=Ue9LSxYvg9yUXGKuz5aZoy_qkUEXde-v6B09exgSctU,2813
|
|
50
50
|
utilities/polars.py,sha256=BgiDryAVOapi41ddfJqN0wYh_sDj8BNEYtPB36LaHdo,71824
|
51
51
|
utilities/polars_ols.py,sha256=Uc9V5kvlWZ5cU93lKZ-cfAKdVFFw81tqwLW9PxtUvMs,5618
|
52
52
|
utilities/postgres.py,sha256=C3TxpQymM7S5ZivxIN_AFTM5g5TtENptzx8-XYf7pow,12182
|
53
|
-
utilities/pottery.py,sha256=
|
53
|
+
utilities/pottery.py,sha256=cdFBjU3Zn-nhlhk4p8IC-ybwFTzk0F2TE1xBV7z8V3c,6296
|
54
54
|
utilities/pqdm.py,sha256=BTsYPtbKQWwX-iXF4qCkfPG7DPxIB54J989n83bXrIo,3092
|
55
55
|
utilities/psutil.py,sha256=KUlu4lrUw9Zg1V7ZGetpWpGb9DB8l_SSDWGbANFNCPU,2104
|
56
56
|
utilities/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -70,7 +70,7 @@ utilities/sqlalchemy.py,sha256=q2aYUDAC3SE88Lt6XaKa3CLzT_ePaWvQu_OuRk19x9g,35520
|
|
70
70
|
utilities/sqlalchemy_polars.py,sha256=18AoEbeNJUKF3-5hroNy9J5LQwS_QJAXbMfKc9sChtk,14250
|
71
71
|
utilities/statsmodels.py,sha256=koyiBHvpMcSiBfh99wFUfSggLNx7cuAw3rwyfAhoKpQ,3410
|
72
72
|
utilities/string.py,sha256=MB0X6UPTUc06JdAdj-PctZ238IXeCjE5dAJibNw6ZrU,587
|
73
|
-
utilities/tempfile.py,sha256=
|
73
|
+
utilities/tempfile.py,sha256=HxB2BF28CcecDJLQ3Bx2Ej-Pb6RJc6W9ngSpB9CnP4k,2018
|
74
74
|
utilities/text.py,sha256=ymBFlP_cA8OgNnZRVNs7FAh7OG8HxE6YkiLEMZv5g_A,11297
|
75
75
|
utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
76
76
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
@@ -89,8 +89,8 @@ utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
|
|
89
89
|
utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
90
90
|
utilities/pytest_plugins/pytest_randomly.py,sha256=NXzCcGKbpgYouz5yehKb4jmxmi2SexKKpgF4M65bi10,414
|
91
91
|
utilities/pytest_plugins/pytest_regressions.py,sha256=Iwhfv_OJH7UCPZCfoh7ugZ2Xjqjil-BBBsOb8sDwiGI,1471
|
92
|
-
dycw_utilities-0.149.
|
93
|
-
dycw_utilities-0.149.
|
94
|
-
dycw_utilities-0.149.
|
95
|
-
dycw_utilities-0.149.
|
96
|
-
dycw_utilities-0.149.
|
92
|
+
dycw_utilities-0.149.8.dist-info/METADATA,sha256=gB1r-_72rhO8ju4t2YyaWdRVCYrIlVRup4s6sxAk5qo,1697
|
93
|
+
dycw_utilities-0.149.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
94
|
+
dycw_utilities-0.149.8.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
95
|
+
dycw_utilities-0.149.8.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
96
|
+
dycw_utilities-0.149.8.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/pottery.py
CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from contextlib import nullcontext, suppress
|
4
4
|
from dataclasses import dataclass
|
5
|
+
from functools import wraps
|
5
6
|
from sys import maxsize
|
6
7
|
from typing import TYPE_CHECKING, override
|
7
8
|
|
@@ -88,13 +89,23 @@ class CoroutineLooper:
|
|
88
89
|
async def __call__[**P](
|
89
90
|
self, func: Callable[P, Coro[None]], *args: P.args, **kwargs: P.kwargs
|
90
91
|
) -> bool:
|
91
|
-
def make_coro() -> Coro[None]:
|
92
|
-
return func(*args, **kwargs)
|
93
|
-
|
94
92
|
return await loop_until_succeed(
|
95
|
-
|
93
|
+
lambda: self._make_coro(func, *args, **kwargs),
|
94
|
+
logger=self.logger,
|
95
|
+
errors=ExtendUnlockedLock,
|
96
|
+
sleep=self.sleep,
|
96
97
|
)
|
97
98
|
|
99
|
+
def _make_coro[**P](
|
100
|
+
self, func: Callable[P, Coro[None]], /, *args: P.args, **kwargs: P.kwargs
|
101
|
+
) -> Coro[None]:
|
102
|
+
@wraps(func)
|
103
|
+
async def wrapped() -> None:
|
104
|
+
await extend_lock(lock=self.lock)
|
105
|
+
return await func(*args, **kwargs)
|
106
|
+
|
107
|
+
return wrapped()
|
108
|
+
|
98
109
|
|
99
110
|
##
|
100
111
|
|
utilities/tempfile.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import tempfile
|
3
4
|
from pathlib import Path
|
4
|
-
from tempfile import TemporaryDirectory as _TemporaryDirectory
|
5
5
|
from tempfile import gettempdir as _gettempdir
|
6
|
-
from typing import TYPE_CHECKING
|
6
|
+
from typing import TYPE_CHECKING, override
|
7
|
+
|
8
|
+
from utilities.warnings import suppress_warnings
|
7
9
|
|
8
10
|
if TYPE_CHECKING:
|
9
11
|
from types import TracebackType
|
@@ -21,13 +23,15 @@ class TemporaryDirectory:
|
|
21
23
|
prefix: str | None = None,
|
22
24
|
dir: PathLike | None = None, # noqa: A002
|
23
25
|
ignore_cleanup_errors: bool = False,
|
26
|
+
delete: bool = True,
|
24
27
|
) -> None:
|
25
28
|
super().__init__()
|
26
|
-
self._temp_dir =
|
29
|
+
self._temp_dir = _TemporaryDirectoryNoResourceWarning(
|
27
30
|
suffix=suffix,
|
28
31
|
prefix=prefix,
|
29
32
|
dir=dir,
|
30
33
|
ignore_cleanup_errors=ignore_cleanup_errors,
|
34
|
+
delete=delete,
|
31
35
|
)
|
32
36
|
self.path = Path(self._temp_dir.name)
|
33
37
|
|
@@ -43,6 +47,25 @@ class TemporaryDirectory:
|
|
43
47
|
self._temp_dir.__exit__(exc, val, tb)
|
44
48
|
|
45
49
|
|
50
|
+
class _TemporaryDirectoryNoResourceWarning(tempfile.TemporaryDirectory):
|
51
|
+
@classmethod
|
52
|
+
@override
|
53
|
+
def _cleanup( # pyright: ignore[reportGeneralTypeIssues]
|
54
|
+
cls,
|
55
|
+
name: str,
|
56
|
+
warn_message: str,
|
57
|
+
ignore_errors: bool = False,
|
58
|
+
delete: bool = True,
|
59
|
+
) -> None:
|
60
|
+
with suppress_warnings(category=ResourceWarning):
|
61
|
+
return super()._cleanup( # pyright: ignore[reportAttributeAccessIssue]
|
62
|
+
name, warn_message, ignore_errors=ignore_errors, delete=delete
|
63
|
+
)
|
64
|
+
|
65
|
+
|
66
|
+
##
|
67
|
+
|
68
|
+
|
46
69
|
def gettempdir() -> Path:
|
47
70
|
"""Get the name of the directory used for temporary files."""
|
48
71
|
return Path(_gettempdir())
|
File without changes
|
File without changes
|
File without changes
|