catchlib 0.0.1__py3-none-any.whl → 1.0.1__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.
catchlib/core/__init__.py CHANGED
@@ -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: 0.0.1
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)
@@ -28,7 +28,7 @@ Project-URL: Download, https://pypi.org/project/catchlib/#files
28
28
  Project-URL: Index, https://pypi.org/project/catchlib/
29
29
  Project-URL: Source, https://github.com/johannes-programming/catchlib/
30
30
  Project-URL: Website, https://catchlib.johannes-programming.online/
31
- Classifier: Development Status :: 2 - Pre-Alpha
31
+ Classifier: Development Status :: 5 - Production/Stable
32
32
  Classifier: License :: OSI Approved :: MIT License
33
33
  Classifier: Natural Language :: English
34
34
  Classifier: Operating System :: OS Independent
@@ -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
  ========
@@ -0,0 +1,9 @@
1
+ catchlib/__init__.py,sha256=LmWT7JBQPWFiRLTuaTqgduz9WH_4q2EyEtZMaBLIWe8,57
2
+ catchlib/core/__init__.py,sha256=3oKcw1izBTbfiuzhR1EFMCsayP9S-lI4qDxYDbGCmCw,1525
3
+ catchlib/tests/__init__.py,sha256=F79E9ssYcoufZpYJ4I6XSvZTR0wkvc9r-5K3XpYvXsY,387
4
+ catchlib/tests/test_0.py,sha256=3GfPlhQRfGxj5fxKtMd--_HwAeE_7RbuRtrltnPHGDQ,2588
5
+ catchlib-1.0.1.dist-info/licenses/LICENSE.txt,sha256=fOh9FHccUt9OcJPBaVJ482GX4yrl_FxCUk9YRZ53JOI,1074
6
+ catchlib-1.0.1.dist-info/METADATA,sha256=58OqoKhzKNVqIkOkkhcKuc8HYHjGs_v7HkRZF30QKIE,2349
7
+ catchlib-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ catchlib-1.0.1.dist-info/top_level.txt,sha256=pZsP_Y2Suk_fAyIQrw4g81DUtgZBRIWzb-5Bk-0jmZs,9
9
+ catchlib-1.0.1.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- catchlib/__init__.py,sha256=LmWT7JBQPWFiRLTuaTqgduz9WH_4q2EyEtZMaBLIWe8,57
2
- catchlib/core/__init__.py,sha256=RGJlPffKlyWeES0noN2qHrJeDXNXv0QVLNpk-Fe_jG8,791
3
- catchlib/tests/__init__.py,sha256=F79E9ssYcoufZpYJ4I6XSvZTR0wkvc9r-5K3XpYvXsY,387
4
- catchlib/tests/test_0.py,sha256=3GfPlhQRfGxj5fxKtMd--_HwAeE_7RbuRtrltnPHGDQ,2588
5
- catchlib-0.0.1.dist-info/licenses/LICENSE.txt,sha256=fOh9FHccUt9OcJPBaVJ482GX4yrl_FxCUk9YRZ53JOI,1074
6
- catchlib-0.0.1.dist-info/METADATA,sha256=Chmh2xEDky8L5pqeDZnlms-TJsymFeF5gVqqmmPPLtE,2303
7
- catchlib-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- catchlib-0.0.1.dist-info/top_level.txt,sha256=pZsP_Y2Suk_fAyIQrw4g81DUtgZBRIWzb-5Bk-0jmZs,9
9
- catchlib-0.0.1.dist-info/RECORD,,