dycw-utilities 0.149.7__py3-none-any.whl → 0.149.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.149.7.dist-info → dycw_utilities-0.149.9.dist-info}/METADATA +1 -1
- {dycw_utilities-0.149.7.dist-info → dycw_utilities-0.149.9.dist-info}/RECORD +8 -8
- utilities/__init__.py +1 -1
- utilities/contextvars.py +20 -1
- utilities/pottery.py +15 -4
- {dycw_utilities-0.149.7.dist-info → dycw_utilities-0.149.9.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.149.7.dist-info → dycw_utilities-0.149.9.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.149.7.dist-info → dycw_utilities-0.149.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=7UA6ND9i7Ndyg5xutxO01u8nzYBz_PGZ-m8ljketKwg,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
|
@@ -7,7 +7,7 @@ utilities/cachetools.py,sha256=v1-9sXHLdOLiwmkq6NB0OUbxeKBuVVN6wmAWefWoaHI,2744
|
|
7
7
|
utilities/click.py,sha256=4godcta2Ozm-s3VvIXeNgoBlK2NIz_Q0XfAq64vAfZY,17369
|
8
8
|
utilities/concurrent.py,sha256=ZdhcNeBl1-HaAPY3h7bZ5ccuYdfdq2ATHplvZdnzlhk,2858
|
9
9
|
utilities/contextlib.py,sha256=THWVU14w3kgVM7TSxn2oHqVdBbdeliABR9gRXiPpo2U,7440
|
10
|
-
utilities/contextvars.py,sha256=
|
10
|
+
utilities/contextvars.py,sha256=J8OhC7jqozAGYOCe2KUWysbPXNGe5JYz3HfaY_mIs08,883
|
11
11
|
utilities/cryptography.py,sha256=_CiK_K6c_-uQuUhsUNjNjTL-nqxAh4_1zTfS11Xe120,972
|
12
12
|
utilities/cvxpy.py,sha256=Rv1-fD-XYerosCavRF8Pohop2DBkU3AlFaGTfD8AEAA,13776
|
13
13
|
utilities/dataclasses.py,sha256=1-REGxtzCo2BbGkjLw5idjbTaiItpOiWvMNbVkJrFXM,32663
|
@@ -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
|
@@ -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.9.dist-info/METADATA,sha256=a_Tgzi2aFO5cYWwQzBVoiQVZQ8cqQgHK1xouAaeSvnU,1697
|
93
|
+
dycw_utilities-0.149.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
94
|
+
dycw_utilities-0.149.9.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
95
|
+
dycw_utilities-0.149.9.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
96
|
+
dycw_utilities-0.149.9.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/contextvars.py
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
from contextlib import contextmanager
|
3
4
|
from contextvars import ContextVar
|
5
|
+
from typing import TYPE_CHECKING
|
6
|
+
|
7
|
+
if TYPE_CHECKING:
|
8
|
+
from collections.abc import Iterator
|
9
|
+
|
4
10
|
|
5
11
|
##
|
6
12
|
|
@@ -19,4 +25,17 @@ def set_global_breakpoint() -> None:
|
|
19
25
|
_ = _GLOBAL_BREAKPOINT.set(True)
|
20
26
|
|
21
27
|
|
22
|
-
|
28
|
+
##
|
29
|
+
|
30
|
+
|
31
|
+
@contextmanager
|
32
|
+
def yield_set_context(var: ContextVar[bool], /) -> Iterator[None]:
|
33
|
+
"""Yield a context var as being set."""
|
34
|
+
token = var.set(True)
|
35
|
+
try:
|
36
|
+
yield
|
37
|
+
finally:
|
38
|
+
_ = var.reset(token)
|
39
|
+
|
40
|
+
|
41
|
+
__all__ = ["global_breakpoint", "set_global_breakpoint", "yield_set_context"]
|
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
|
|
File without changes
|
File without changes
|
File without changes
|