dycw-utilities 0.149.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.149.8
3
+ Version: 0.149.9
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=Mf4foS-np1iwUCHqRFsn8rDza6YFtUS6QuzGZs1-8EE,60
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=RsSGGrbQqqZ67rOydnM7WWIsM2lIE31UHJLejnHJPWY,505
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
@@ -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.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,,
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
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.149.8"
3
+ __version__ = "0.149.9"
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
- __all__ = ["global_breakpoint", "set_global_breakpoint"]
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"]