catchlib 1.0.3__tar.gz → 1.0.5__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
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2025 Johannes
3
+ Copyright (c) 2026 Johannes
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchlib
3
- Version: 1.0.3
4
- Summary: This project allows to catch exceptions easily.
3
+ Version: 1.0.5
4
+ Summary: catchlib
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
7
7
 
8
- Copyright (c) 2025 Johannes
8
+ Copyright (c) 2026 Johannes
9
9
 
10
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
11
11
  of this software and associated documentation files (the "Software"), to deal
@@ -27,7 +27,6 @@ License: The MIT License (MIT)
27
27
  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
- Project-URL: Website, https://catchlib.johannes-programming.online/
31
30
  Classifier: Development Status :: 5 - Production/Stable
32
31
  Classifier: License :: OSI Approved :: MIT License
33
32
  Classifier: Natural Language :: English
@@ -39,11 +38,42 @@ Classifier: Typing :: Typed
39
38
  Requires-Python: >=3.11
40
39
  Description-Content-Type: text/x-rst
41
40
  License-File: LICENSE.txt
42
- Requires-Dist: overloadable<2,>=1.0.9
43
41
  Dynamic: license-file
44
42
 
45
43
  ========
46
44
  catchlib
47
45
  ========
48
46
 
49
- Visit the website `https://catchlib.johannes-programming.online/ <https://catchlib.johannes-programming.online/>`_ for more information.
47
+ Overview
48
+ --------
49
+
50
+ catchlib
51
+
52
+ Installation
53
+ ------------
54
+
55
+ To install ``catchlib``, you can use ``pip``. Open your terminal and run:
56
+
57
+ .. code-block:: bash
58
+
59
+ pip install catchlib
60
+
61
+ License
62
+ -------
63
+
64
+ This project is licensed under the MIT License.
65
+
66
+ Links
67
+ -----
68
+
69
+ * `Download <https://pypi.org/project/catchlib/#files>`_
70
+ * `Index <https://pypi.org/project/catchlib/>`_
71
+ * `Source <https://github.com/johannes-programming/catchlib/>`_
72
+
73
+ Credits
74
+ -------
75
+
76
+ * Author: Johannes
77
+ * Email: `johannes.programming@gmail.com <mailto:johannes.programming@gmail.com>`_
78
+
79
+ Thank you for using ``catchlib``!
@@ -0,0 +1,37 @@
1
+ ========
2
+ catchlib
3
+ ========
4
+
5
+ Overview
6
+ --------
7
+
8
+ catchlib
9
+
10
+ Installation
11
+ ------------
12
+
13
+ To install ``catchlib``, you can use ``pip``. Open your terminal and run:
14
+
15
+ .. code-block:: bash
16
+
17
+ pip install catchlib
18
+
19
+ License
20
+ -------
21
+
22
+ This project is licensed under the MIT License.
23
+
24
+ Links
25
+ -----
26
+
27
+ * `Download <https://pypi.org/project/catchlib/#files>`_
28
+ * `Index <https://pypi.org/project/catchlib/>`_
29
+ * `Source <https://github.com/johannes-programming/catchlib/>`_
30
+
31
+ Credits
32
+ -------
33
+
34
+ * Author: Johannes
35
+ * Email: `johannes.programming@gmail.com <mailto:johannes.programming@gmail.com>`_
36
+
37
+ Thank you for using ``catchlib``!
@@ -1,7 +1,7 @@
1
1
  [build-system]
2
2
  build-backend = "setuptools.build_meta"
3
3
  requires = [
4
- "setuptools>=61.0",
4
+ "setuptools>=64.0",
5
5
  ]
6
6
 
7
7
  [project]
@@ -18,15 +18,13 @@ classifiers = [
18
18
  "Programming Language :: Python :: 3 :: Only",
19
19
  "Typing :: Typed",
20
20
  ]
21
- dependencies = [
22
- "overloadable>=1.0.9,<2",
23
- ]
24
- description = "This project allows to catch exceptions easily."
21
+ dependencies = []
22
+ description = "catchlib"
25
23
  keywords = []
26
24
  name = "catchlib"
27
25
  readme = "README.rst"
28
26
  requires-python = ">=3.11"
29
- version = "1.0.3"
27
+ version = "1.0.5"
30
28
 
31
29
  [project.license]
32
30
  file = "LICENSE.txt"
@@ -35,4 +33,3 @@ file = "LICENSE.txt"
35
33
  Download = "https://pypi.org/project/catchlib/#files"
36
34
  Index = "https://pypi.org/project/catchlib/"
37
35
  Source = "https://github.com/johannes-programming/catchlib/"
38
- Website = "https://catchlib.johannes-programming.online/"
@@ -1,2 +1,5 @@
1
1
  from catchlib.core import *
2
2
  from catchlib.tests import *
3
+
4
+ if __name__ == "__main__":
5
+ main()
@@ -0,0 +1,4 @@
1
+ from catchlib import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
@@ -0,0 +1,8 @@
1
+ from typing import *
2
+
3
+ __all__ = ["main"]
4
+
5
+
6
+ def main(args: Optional[Iterable] = None) -> None:
7
+ "This function prints 'Hello World!'."
8
+ print("Hello World!")
@@ -6,11 +6,11 @@ __all__ = ["test"]
6
6
  def test() -> unittest.TextTestRunner:
7
7
  "This function runs all the tests."
8
8
  loader: unittest.TestLoader
9
- tests: unittest.TestSuite
9
+ suite: unittest.TestSuite
10
10
  runner: unittest.TextTestRunner
11
11
  result: unittest.TextTestResult
12
12
  loader = unittest.TestLoader()
13
- tests = loader.discover(start_dir="catchlib.tests")
13
+ suite = loader.discover(start_dir="catchlib.tests")
14
14
  runner = unittest.TextTestRunner()
15
- result = runner.run(tests)
15
+ result = runner.run(suite)
16
16
  return result
@@ -0,0 +1,11 @@
1
+ import unittest
2
+ from typing import *
3
+
4
+
5
+ class Test1984(unittest.TestCase):
6
+ def test_1984(self: Self) -> None:
7
+ self.assertEqual(2 + 2, 4, "Ignorance is Strength")
8
+
9
+
10
+ if __name__ == "__main__":
11
+ unittest.main()
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchlib
3
- Version: 1.0.3
4
- Summary: This project allows to catch exceptions easily.
3
+ Version: 1.0.5
4
+ Summary: catchlib
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
7
7
 
8
- Copyright (c) 2025 Johannes
8
+ Copyright (c) 2026 Johannes
9
9
 
10
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
11
11
  of this software and associated documentation files (the "Software"), to deal
@@ -27,7 +27,6 @@ License: The MIT License (MIT)
27
27
  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
- Project-URL: Website, https://catchlib.johannes-programming.online/
31
30
  Classifier: Development Status :: 5 - Production/Stable
32
31
  Classifier: License :: OSI Approved :: MIT License
33
32
  Classifier: Natural Language :: English
@@ -39,11 +38,42 @@ Classifier: Typing :: Typed
39
38
  Requires-Python: >=3.11
40
39
  Description-Content-Type: text/x-rst
41
40
  License-File: LICENSE.txt
42
- Requires-Dist: overloadable<2,>=1.0.9
43
41
  Dynamic: license-file
44
42
 
45
43
  ========
46
44
  catchlib
47
45
  ========
48
46
 
49
- Visit the website `https://catchlib.johannes-programming.online/ <https://catchlib.johannes-programming.online/>`_ for more information.
47
+ Overview
48
+ --------
49
+
50
+ catchlib
51
+
52
+ Installation
53
+ ------------
54
+
55
+ To install ``catchlib``, you can use ``pip``. Open your terminal and run:
56
+
57
+ .. code-block:: bash
58
+
59
+ pip install catchlib
60
+
61
+ License
62
+ -------
63
+
64
+ This project is licensed under the MIT License.
65
+
66
+ Links
67
+ -----
68
+
69
+ * `Download <https://pypi.org/project/catchlib/#files>`_
70
+ * `Index <https://pypi.org/project/catchlib/>`_
71
+ * `Source <https://github.com/johannes-programming/catchlib/>`_
72
+
73
+ Credits
74
+ -------
75
+
76
+ * Author: Johannes
77
+ * Email: `johannes.programming@gmail.com <mailto:johannes.programming@gmail.com>`_
78
+
79
+ Thank you for using ``catchlib``!
@@ -4,11 +4,11 @@ README.rst
4
4
  pyproject.toml
5
5
  setup.cfg
6
6
  src/catchlib/__init__.py
7
+ src/catchlib/__main__.py
7
8
  src/catchlib.egg-info/PKG-INFO
8
9
  src/catchlib.egg-info/SOURCES.txt
9
10
  src/catchlib.egg-info/dependency_links.txt
10
- src/catchlib.egg-info/requires.txt
11
11
  src/catchlib.egg-info/top_level.txt
12
12
  src/catchlib/core/__init__.py
13
13
  src/catchlib/tests/__init__.py
14
- src/catchlib/tests/test_0.py
14
+ src/catchlib/tests/test_1984.py
catchlib-1.0.3/README.rst DELETED
@@ -1,5 +0,0 @@
1
- ========
2
- catchlib
3
- ========
4
-
5
- Visit the website `https://catchlib.johannes-programming.online/ <https://catchlib.johannes-programming.online/>`_ for more information.
@@ -1,56 +0,0 @@
1
- from contextlib import contextmanager
2
- from typing import *
3
-
4
- from overloadable import Overloadable
5
-
6
- __all__ = ["Catcher"]
7
-
8
-
9
- class Catcher:
10
- "This class catches exceptions."
11
-
12
- __slots__ = ("_caught",)
13
-
14
- caught: Optional[BaseException]
15
-
16
- def __init__(self: Self) -> None:
17
- "This magic method initializes the current instance."
18
- self._caught = None
19
-
20
- @contextmanager
21
- def catch(self: Self, *args: type[BaseException]) -> Generator[Self, None, None]:
22
- "This contextmanager catches exceptions."
23
- exc: BaseException
24
- self._caught = None
25
- try:
26
- yield self
27
- except args as exc:
28
- self._caught = exc
29
-
30
- @property
31
- def caught(self: Self) -> Optional[BaseException]:
32
- "This property stores the caught exception."
33
- return self._caught
34
-
35
- @Overloadable
36
- def release(self: Self, *args: Any, **kwargs: Any) -> bool:
37
- "This method raises the caught exception."
38
- return bool(len(args) + len(kwargs))
39
-
40
- @release.overload(False)
41
- def release(self: Self) -> None:
42
- "This method raises the caught exception."
43
- exc: BaseException
44
- exc = 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
53
- exc = self.caught
54
- self._caught = None
55
- if exc is not None:
56
- raise exc from cause
@@ -1,78 +0,0 @@
1
- import unittest
2
- from typing import *
3
-
4
- from catchlib.core import Catcher
5
-
6
- __all__ = ["TestCatcher"]
7
-
8
-
9
- class TestCatcher(unittest.TestCase):
10
- def test_captures_matching_exception(self: Self) -> None:
11
- catcher: Catcher
12
- catcher = Catcher()
13
- with catcher.catch(ValueError):
14
- raise ValueError("bad value")
15
- self.assertIsNotNone(catcher.caught)
16
- self.assertIsInstance(catcher.caught, ValueError)
17
- self.assertEqual(str(catcher.caught), "bad value")
18
-
19
- def test_no_exception_leaves_caught_none(self: Self) -> None:
20
- catcher: Catcher
21
- catcher = Catcher()
22
- with catcher.catch(ValueError):
23
- pass
24
- self.assertIsNone(catcher.caught)
25
-
26
- def test_captures_one_of_multiple_types(self: Self) -> None:
27
- catcher: Catcher
28
- catcher = Catcher()
29
- with catcher.catch(ValueError, KeyError):
30
- raise KeyError("missing")
31
- self.assertIsNotNone(catcher.caught)
32
- self.assertIsInstance(catcher.caught, KeyError)
33
- self.assertEqual(
34
- str(catcher.caught), "'missing'"
35
- ) # KeyError stringifies with quotes
36
-
37
- def test_non_matching_exception_propagates_and_does_not_set_caught(
38
- self: Self,
39
- ) -> None:
40
- catcher: Catcher
41
- catcher = Catcher()
42
- with self.assertRaises(ZeroDivisionError):
43
- with catcher.catch(ValueError, KeyError):
44
- 1 / 0 # ZeroDivisionError not in capture set
45
- # Since the exception propagated out, Catcher should not have recorded anything
46
- self.assertIsNone(catcher.caught)
47
-
48
- def test_reuse_and_reset_semantics(self: Self) -> None:
49
- catcher: Catcher
50
- catcher = Catcher()
51
-
52
- # First, capture an exception
53
- with catcher.catch(RuntimeError):
54
- raise RuntimeError("first")
55
- self.assertIsInstance(catcher.caught, RuntimeError)
56
-
57
- # Next, a clean block should reset caught to None
58
- with catcher.catch(RuntimeError):
59
- pass
60
- self.assertIsNone(catcher.caught)
61
-
62
- # Finally, capture another (different) exception type by passing multiple
63
- with catcher.catch(RuntimeError, TypeError):
64
- raise TypeError("second")
65
- self.assertIsInstance(catcher.caught, TypeError)
66
-
67
- def test_empty_type_tuple_never_catches(self: Self) -> None:
68
- catcher: Catcher
69
- catcher = Catcher()
70
- # Passing no types should behave like catching nothing: exception propagates
71
- with self.assertRaises(ValueError):
72
- with catcher.catch():
73
- raise ValueError("won't be caught")
74
- self.assertIsNone(catcher.caught)
75
-
76
-
77
- if __name__ == "__main__":
78
- unittest.main()
@@ -1 +0,0 @@
1
- overloadable<2,>=1.0.9
File without changes
File without changes