zstdlib 0.10.2__tar.gz → 0.10.3__tar.gz
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.
- {zstdlib-0.10.2 → zstdlib-0.10.3}/PKG-INFO +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_exc_capture.py +2 -3
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/__init__.py +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/exc_capture.py +7 -9
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/PKG-INFO +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.3}/LICENSE +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/README.md +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/pyproject.toml +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/setup.cfg +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/__init__.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/__init__.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/base.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/test_cute.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/test_trace.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_ansi.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_enum.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_frozen.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_io.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_lazy.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_not_set.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_singleton.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/ansi.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/enum.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/frozen.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/io.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/lazy.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/log/__init__.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/log/cute.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/log/trace.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/macos.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/not_set.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/py.typed +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/signal_cm.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/singleton.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/SOURCES.txt +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/dependency_links.txt +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/requires.txt +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/top_level.txt +0 -0
|
@@ -79,9 +79,8 @@ class TestLazy(unittest.TestCase):
|
|
|
79
79
|
# armed
|
|
80
80
|
with ExcDelay("", RuntimeError, armed=False) as capture, capture():
|
|
81
81
|
raise RuntimeError()
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
ed.armed = False
|
|
82
|
+
with ExcDelay("", RuntimeError, armed=True) as capture, capture():
|
|
83
|
+
capture.armed = False
|
|
85
84
|
raise RuntimeError()
|
|
86
85
|
with self.assertRaises(ExceptionGroup), ExcDelay("", RuntimeError, armed=True) as capture, capture():
|
|
87
86
|
raise RuntimeError()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from contextlib import AbstractContextManager, contextmanager
|
|
2
2
|
from collections.abc import Iterator
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Self
|
|
4
4
|
|
|
5
5
|
__all__ = ("ExcCapture", "ExcDelay")
|
|
6
6
|
|
|
@@ -8,12 +8,6 @@ __all__ = ("ExcCapture", "ExcDelay")
|
|
|
8
8
|
type EXC_T = type[BaseException] | tuple[type[BaseException]]
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class CaptureFType(Protocol):
|
|
12
|
-
"""The type of the capture function (used for type checking)"""
|
|
13
|
-
|
|
14
|
-
def __call__(self, exc_t: EXC_T | None = None) -> AbstractContextManager[None]: ...
|
|
15
|
-
|
|
16
|
-
|
|
17
11
|
class ExcCapture:
|
|
18
12
|
"""A class that exposes a context manager which captures and suppresses any raised exception of a given type / tuple of types"""
|
|
19
13
|
|
|
@@ -45,6 +39,10 @@ class ExcCapture:
|
|
|
45
39
|
self.previous = e
|
|
46
40
|
self.errors.append(e)
|
|
47
41
|
|
|
42
|
+
def __call__(self, exc_t: EXC_T | None = None) -> AbstractContextManager[None]:
|
|
43
|
+
"""An alias for .capture"""
|
|
44
|
+
return self.capture(exc_t)
|
|
45
|
+
|
|
48
46
|
|
|
49
47
|
class ExcDelay(ExcCapture):
|
|
50
48
|
"""A context manager subclass of ExcCapture that raises on exit if errors are captured"""
|
|
@@ -70,9 +68,9 @@ class ExcDelay(ExcCapture):
|
|
|
70
68
|
self._msg: str = msg
|
|
71
69
|
super().__init__(exc_t)
|
|
72
70
|
|
|
73
|
-
def __enter__(self) ->
|
|
71
|
+
def __enter__(self) -> Self:
|
|
74
72
|
"""Return the capture function to use"""
|
|
75
|
-
return self
|
|
73
|
+
return self
|
|
76
74
|
|
|
77
75
|
def __exit__(self, type_: type[BaseException] | None, *_: object) -> None:
|
|
78
76
|
"""Raise an ExceptionGroup (or BaseExceptionGroup depending on exc_t) if self.errors"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|