catchlib 1.0.0__tar.gz → 1.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchlib
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: This project allows to catch exceptions easily.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -39,6 +39,7 @@ Classifier: Typing :: Typed
39
39
  Requires-Python: >=3.11
40
40
  Description-Content-Type: text/x-rst
41
41
  License-File: LICENSE.txt
42
+ Requires-Dist: overloadable<2,>=1.0.9
42
43
  Dynamic: license-file
43
44
 
44
45
  ========
@@ -18,13 +18,15 @@ classifiers = [
18
18
  "Programming Language :: Python :: 3 :: Only",
19
19
  "Typing :: Typed",
20
20
  ]
21
- dependencies = []
21
+ dependencies = [
22
+ "overloadable>=1.0.9,<2",
23
+ ]
22
24
  description = "This project allows to catch exceptions easily."
23
25
  keywords = []
24
26
  name = "catchlib"
25
27
  readme = "README.rst"
26
28
  requires-python = ">=3.11"
27
- version = "1.0.0"
29
+ version = "1.0.1"
28
30
 
29
31
  [project.license]
30
32
  file = "LICENSE.txt"
@@ -1,6 +1,8 @@
1
1
  from contextlib import contextmanager
2
2
  from typing import *
3
3
 
4
+ from overloadable import Overloadable
5
+
4
6
  __all__ = ["Catcher"]
5
7
 
6
8
 
@@ -30,3 +32,24 @@ class Catcher:
30
32
  def caught(self: Self) -> Optional[BaseException]:
31
33
  "This property stores the caught exception."
32
34
  return self._caught
35
+
36
+ @Overloadable
37
+ def release(self: Self, *args: Any, **kwargs: Any) -> bool:
38
+ "This method raises the caught exception."
39
+ return bool(len(args) + len(kwargs))
40
+
41
+ @release.overload(False)
42
+ def release(self: Self) -> None:
43
+ "This method raises the caught exception."
44
+ exc: BaseException = self.caught
45
+ self._caught = None
46
+ if exc is not None:
47
+ raise exc
48
+
49
+ @release.overload(True)
50
+ def release(self: Self, cause: Optional[BaseException]) -> None:
51
+ "This method raises the caught exception."
52
+ exc: BaseException = self.caught
53
+ self._caught = None
54
+ if exc is not None:
55
+ raise exc from cause
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchlib
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: This project allows to catch exceptions easily.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -39,6 +39,7 @@ Classifier: Typing :: Typed
39
39
  Requires-Python: >=3.11
40
40
  Description-Content-Type: text/x-rst
41
41
  License-File: LICENSE.txt
42
+ Requires-Dist: overloadable<2,>=1.0.9
42
43
  Dynamic: license-file
43
44
 
44
45
  ========
@@ -7,6 +7,7 @@ src/catchlib/__init__.py
7
7
  src/catchlib.egg-info/PKG-INFO
8
8
  src/catchlib.egg-info/SOURCES.txt
9
9
  src/catchlib.egg-info/dependency_links.txt
10
+ src/catchlib.egg-info/requires.txt
10
11
  src/catchlib.egg-info/top_level.txt
11
12
  src/catchlib/core/__init__.py
12
13
  src/catchlib/tests/__init__.py
@@ -0,0 +1 @@
1
+ overloadable<2,>=1.0.9
File without changes
File without changes
File without changes
File without changes