catchlib 1.1.2__tar.gz → 1.1.4__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.
- {catchlib-1.1.2/src/catchlib.egg-info → catchlib-1.1.4}/PKG-INFO +1 -1
- {catchlib-1.1.2 → catchlib-1.1.4}/pyproject.toml +2 -2
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib/core/Catcher.py +7 -5
- {catchlib-1.1.2 → catchlib-1.1.4/src/catchlib.egg-info}/PKG-INFO +1 -1
- {catchlib-1.1.2 → catchlib-1.1.4}/LICENSE.txt +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/MANIFEST.in +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/README.rst +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/docs/v1.0.rst +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/docs/v1.1.rst +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/setup.cfg +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib/__init__.py +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib/core/__init__.py +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib/py.typed +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib/tests/__init__.py +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib/tests/test_0.py +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib.egg-info/SOURCES.txt +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib.egg-info/dependency_links.txt +0 -0
- {catchlib-1.1.2 → catchlib-1.1.4}/src/catchlib.egg-info/top_level.txt +0 -0
|
@@ -27,7 +27,7 @@ license-files = [
|
|
|
27
27
|
name = "catchlib"
|
|
28
28
|
readme = "README.rst"
|
|
29
29
|
requires-python = ">=3.11"
|
|
30
|
-
version = "1.1.
|
|
30
|
+
version = "1.1.4"
|
|
31
31
|
|
|
32
32
|
[project.urls]
|
|
33
33
|
Download = "https://pypi.org/project/catchlib/#files"
|
|
@@ -40,4 +40,4 @@ files = [
|
|
|
40
40
|
".",
|
|
41
41
|
]
|
|
42
42
|
python_version = "3.11"
|
|
43
|
-
strict =
|
|
43
|
+
strict = true
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from contextlib import contextmanager
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Final, Generator, Optional, Self, cast, overload
|
|
3
3
|
|
|
4
4
|
__all__ = ["Catcher"]
|
|
5
5
|
|
|
6
|
-
DEFAULT = object()
|
|
6
|
+
DEFAULT: Final[object] = object()
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Catcher:
|
|
@@ -18,7 +18,9 @@ class Catcher:
|
|
|
18
18
|
self._caught = None
|
|
19
19
|
|
|
20
20
|
@contextmanager
|
|
21
|
-
def catch(
|
|
21
|
+
def catch(
|
|
22
|
+
self: Self, *args: type[BaseException]
|
|
23
|
+
) -> Generator[Self, None, None]:
|
|
22
24
|
"This contextmanager catches exceptions."
|
|
23
25
|
exc: BaseException
|
|
24
26
|
self._caught = None
|
|
@@ -40,7 +42,7 @@ class Catcher:
|
|
|
40
42
|
|
|
41
43
|
def release(
|
|
42
44
|
self: Self,
|
|
43
|
-
cause:
|
|
45
|
+
cause: Optional[BaseException] | object = DEFAULT,
|
|
44
46
|
) -> None:
|
|
45
47
|
"This method raises the caught exception."
|
|
46
48
|
exc: Optional[BaseException]
|
|
@@ -51,4 +53,4 @@ class Catcher:
|
|
|
51
53
|
if cause is DEFAULT:
|
|
52
54
|
raise exc
|
|
53
55
|
else:
|
|
54
|
-
raise exc from cause
|
|
56
|
+
raise exc from cast(Optional[BaseException], cause)
|
|
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
|