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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchlib
3
- Version: 1.1.2
3
+ Version: 1.1.4
4
4
  Summary: This project allows to catch exceptions easily.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
@@ -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.2"
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 = false
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(self: Self, *args: type[BaseException]) -> Generator[Self, None, None]:
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: Any = DEFAULT,
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchlib
3
- Version: 1.1.2
3
+ Version: 1.1.4
4
4
  Summary: This project allows to catch exceptions easily.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes