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.
Files changed (38) hide show
  1. {zstdlib-0.10.2 → zstdlib-0.10.3}/PKG-INFO +1 -1
  2. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_exc_capture.py +2 -3
  3. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/__init__.py +1 -1
  4. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/exc_capture.py +7 -9
  5. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/PKG-INFO +1 -1
  6. {zstdlib-0.10.2 → zstdlib-0.10.3}/LICENSE +0 -0
  7. {zstdlib-0.10.2 → zstdlib-0.10.3}/README.md +0 -0
  8. {zstdlib-0.10.2 → zstdlib-0.10.3}/pyproject.toml +0 -0
  9. {zstdlib-0.10.2 → zstdlib-0.10.3}/setup.cfg +0 -0
  10. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/__init__.py +0 -0
  11. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/__init__.py +0 -0
  12. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/base.py +0 -0
  13. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/test_cute.py +0 -0
  14. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/log/test_trace.py +0 -0
  15. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_ansi.py +0 -0
  16. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_enum.py +0 -0
  17. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_frozen.py +0 -0
  18. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_io.py +0 -0
  19. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_lazy.py +0 -0
  20. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_not_set.py +0 -0
  21. {zstdlib-0.10.2 → zstdlib-0.10.3}/tests/test_singleton.py +0 -0
  22. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/ansi.py +0 -0
  23. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/enum.py +0 -0
  24. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/frozen.py +0 -0
  25. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/io.py +0 -0
  26. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/lazy.py +0 -0
  27. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/log/__init__.py +0 -0
  28. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/log/cute.py +0 -0
  29. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/log/trace.py +0 -0
  30. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/macos.py +0 -0
  31. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/not_set.py +0 -0
  32. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/py.typed +0 -0
  33. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/signal_cm.py +0 -0
  34. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib/singleton.py +0 -0
  35. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/SOURCES.txt +0 -0
  36. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/dependency_links.txt +0 -0
  37. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/requires.txt +0 -0
  38. {zstdlib-0.10.2 → zstdlib-0.10.3}/zstdlib.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zstdlib
3
- Version: 0.10.2
3
+ Version: 0.10.3
4
4
  Summary: A set of useful python utilities
5
5
  License: GPLv3
6
6
  Project-URL: Homepage, https://github.com/zwimer/zstdlib
@@ -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
- ed = ExcDelay("", RuntimeError, armed=True)
83
- with ed as capture, capture():
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,4 +1,4 @@
1
- __version__ = "0.10.2"
1
+ __version__ = "0.10.3"
2
2
 
3
3
  from .exc_capture import ExcCapture, ExcDelay
4
4
  from .not_set import NotSetType, NotSet
@@ -1,6 +1,6 @@
1
1
  from contextlib import AbstractContextManager, contextmanager
2
2
  from collections.abc import Iterator
3
- from typing import Protocol
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) -> CaptureFType:
71
+ def __enter__(self) -> Self:
74
72
  """Return the capture function to use"""
75
- return self.capture
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"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zstdlib
3
- Version: 0.10.2
3
+ Version: 0.10.3
4
4
  Summary: A set of useful python utilities
5
5
  License: GPLv3
6
6
  Project-URL: Homepage, https://github.com/zwimer/zstdlib
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