raisefunction 1.0.4__tar.gz → 1.1.0__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.
Files changed (23) hide show
  1. {raisefunction-1.0.4 → raisefunction-1.1.0}/LICENSE.txt +1 -1
  2. raisefunction-1.1.0/MANIFEST.in +2 -0
  3. {raisefunction-1.0.4/src/raisefunction.egg-info → raisefunction-1.1.0}/PKG-INFO +8 -5
  4. raisefunction-1.1.0/README.rst +7 -0
  5. raisefunction-1.1.0/docs/v1.0.rst +55 -0
  6. raisefunction-1.1.0/docs/v1.1.rst +64 -0
  7. {raisefunction-1.0.4 → raisefunction-1.1.0}/pyproject.toml +9 -2
  8. raisefunction-1.1.0/src/raisefunction/__init__.py +2 -0
  9. raisefunction-1.1.0/src/raisefunction/core/__init__.py +27 -0
  10. {raisefunction-1.0.4 → raisefunction-1.1.0}/src/raisefunction/tests/__init__.py +1 -1
  11. {raisefunction-1.0.4 → raisefunction-1.1.0}/src/raisefunction/tests/test_0.py +15 -11
  12. raisefunction-1.1.0/src/raisefunction/tests/test_1.py +66 -0
  13. raisefunction-1.1.0/src/raisefunction/tests/test_2.py +78 -0
  14. raisefunction-1.1.0/src/raisefunction/tests/test_3.py +42 -0
  15. {raisefunction-1.0.4 → raisefunction-1.1.0/src/raisefunction.egg-info}/PKG-INFO +8 -5
  16. {raisefunction-1.0.4 → raisefunction-1.1.0}/src/raisefunction.egg-info/SOURCES.txt +7 -1
  17. raisefunction-1.0.4/README.rst +0 -5
  18. raisefunction-1.0.4/src/raisefunction/__init__.py +0 -5
  19. raisefunction-1.0.4/src/raisefunction/core/__init__.py +0 -22
  20. {raisefunction-1.0.4 → raisefunction-1.1.0}/setup.cfg +0 -0
  21. /raisefunction-1.0.4/MANIFEST.in → /raisefunction-1.1.0/src/raisefunction/py.typed +0 -0
  22. {raisefunction-1.0.4 → raisefunction-1.1.0}/src/raisefunction.egg-info/dependency_links.txt +0 -0
  23. {raisefunction-1.0.4 → raisefunction-1.1.0}/src/raisefunction.egg-info/top_level.txt +0 -0
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ recursive-include docs *.rst
2
+ recursive-include src/raisefunction *.toml
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: raisefunction
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: This project provides a function that raises errors passed to it.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -24,6 +24,7 @@ License: The MIT License (MIT)
24
24
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
+
27
28
  Project-URL: Download, https://pypi.org/project/raisefunction/#files
28
29
  Project-URL: Index, https://pypi.org/project/raisefunction/
29
30
  Project-URL: Source, https://github.com/johannes-programming/raisefunction/
@@ -42,8 +43,10 @@ Description-Content-Type: text/x-rst
42
43
  License-File: LICENSE.txt
43
44
  Dynamic: license-file
44
45
 
45
- =============
46
- raisefunction
47
- =============
46
+ ====
47
+ v440
48
+ ====
48
49
 
49
- Visit the website `https://raisefunction.johannes-programming.online/ <https://raisefunction.johannes-programming.online/>`_ for more information.
50
+ Each minor version has its own documentation.
51
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
52
+ They can also be viewed on the website `https://raisefunction.johannes-programming.online/ <https://raisefunction.johannes-programming.online/>`_.
@@ -0,0 +1,7 @@
1
+ ====
2
+ v440
3
+ ====
4
+
5
+ Each minor version has its own documentation.
6
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
7
+ They can also be viewed on the website `https://raisefunction.johannes-programming.online/ <https://raisefunction.johannes-programming.online/>`_.
@@ -0,0 +1,55 @@
1
+ Introduction
2
+ ------------
3
+
4
+ This project provides a function that raises errors passed to it.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ To install ``raisefunction``, you can use ``pip``.
10
+ Open your terminal and run:
11
+
12
+ .. code-block:: shell
13
+
14
+ pip install raisefunction
15
+
16
+ Features
17
+ --------
18
+
19
+ ``raisefunction.raisefunction(exc: BaseException) -> Never`` ``raisefunction.raisefunction(exc: BaseException, cause: Optional[BaseException]) -> Never``
20
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
+
22
+ This function binds the raise command.
23
+
24
+ ``raisefunction.tests.test() -> unittest.TextTestResult``
25
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
+
27
+ This project can be tested through its test function.
28
+
29
+ .. code-block:: python
30
+
31
+ import raisefunction.tests
32
+ raisefunction.tests.test()
33
+
34
+ License
35
+ -------
36
+
37
+ This project is licensed under the MIT License.
38
+
39
+ Links
40
+ -----
41
+
42
+ - Download: https://pypi.org/project/raisefunction/#files
43
+ - Index: https://pypi.org/project/raisefunction/
44
+ - Source: https://github.com/johannes-programming/raisefunction/
45
+ - Website: https://raisefunction.johannes-programming.online/
46
+
47
+ Impressum
48
+ ---------
49
+
50
+ **Johannes Programming**
51
+
52
+ - Name: Johannes
53
+ - Email: johannes.programming@gmail.com
54
+ - Homepage: https://www.johannes-programming.online/
55
+ - Gravatar: https://www.johannes-programming.fyi/
@@ -0,0 +1,64 @@
1
+ Introduction
2
+ ------------
3
+
4
+ This project provides a function that raises errors passed to it.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ To install ``raisefunction``, you can use ``pip``.
10
+ Open your terminal and run:
11
+
12
+ .. code-block:: shell
13
+
14
+ pip install raisefunction
15
+
16
+ Typing
17
+ ------
18
+
19
+ This project is strictly typed with ``mypy``.
20
+
21
+ .. container:: versionadded
22
+
23
+ **Added in version 1.1.**
24
+
25
+ Features
26
+ --------
27
+
28
+ ``raisefunction.raisefunction(exc: BaseException) -> Never`` ``raisefunction.raisefunction(exc: BaseException, cause: Optional[BaseException]) -> Never``
29
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30
+
31
+ This function binds the raise command.
32
+
33
+ ``raisefunction.tests.test() -> unittest.TextTestResult``
34
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35
+
36
+ This project can be tested through its test function.
37
+
38
+ .. code-block:: python
39
+
40
+ import raisefunction.tests
41
+ raisefunction.tests.test()
42
+
43
+ License
44
+ -------
45
+
46
+ This project is licensed under the MIT License.
47
+
48
+ Links
49
+ -----
50
+
51
+ - Download: https://pypi.org/project/raisefunction/#files
52
+ - Index: https://pypi.org/project/raisefunction/
53
+ - Source: https://github.com/johannes-programming/raisefunction/
54
+ - Website: https://raisefunction.johannes-programming.online/
55
+
56
+ Impressum
57
+ ---------
58
+
59
+ **Johannes Programming**
60
+
61
+ - Name: Johannes
62
+ - Email: johannes.programming@gmail.com
63
+ - Homepage: https://www.johannes-programming.online/
64
+ - Gravatar: https://www.johannes-programming.fyi/
@@ -1,7 +1,7 @@
1
1
  [build-system]
2
2
  build-backend = "setuptools.build_meta"
3
3
  requires = [
4
- "setuptools>=64.0",
4
+ "setuptools>=77.0",
5
5
  ]
6
6
 
7
7
  [project]
@@ -25,7 +25,7 @@ keywords = []
25
25
  name = "raisefunction"
26
26
  readme = "README.rst"
27
27
  requires-python = ">=3.11"
28
- version = "1.0.4"
28
+ version = "1.1.0"
29
29
 
30
30
  [project.license]
31
31
  file = "LICENSE.txt"
@@ -35,3 +35,10 @@ Download = "https://pypi.org/project/raisefunction/#files"
35
35
  Index = "https://pypi.org/project/raisefunction/"
36
36
  Source = "https://github.com/johannes-programming/raisefunction/"
37
37
  Website = "https://raisefunction.johannes-programming.online/"
38
+
39
+ [tool.mypy]
40
+ files = [
41
+ ".",
42
+ ]
43
+ python_version = "3.11"
44
+ strict = true
@@ -0,0 +1,2 @@
1
+ from raisefunction.core import raisefunction
2
+ from raisefunction.tests import test
@@ -0,0 +1,27 @@
1
+ from typing import Final, Never, Optional, cast, overload
2
+
3
+ __all__ = ["raisefunction"]
4
+
5
+ DEFAULT: Final[object] = object()
6
+
7
+
8
+ @overload
9
+ def raisefunction(
10
+ exc: BaseException | type[BaseException],
11
+ ) -> Never: ...
12
+ @overload
13
+ def raisefunction(
14
+ exc: BaseException | type[BaseException],
15
+ cause: Optional[BaseException],
16
+ ) -> Never: ...
17
+
18
+
19
+ def raisefunction(
20
+ exc: BaseException | type[BaseException],
21
+ cause: Optional[BaseException] | object = DEFAULT,
22
+ ) -> Never:
23
+ "This function raises the given exception."
24
+ if cause is DEFAULT:
25
+ raise exc
26
+ else:
27
+ raise exc from cast(Optional[BaseException], cause)
@@ -3,7 +3,7 @@ import unittest
3
3
  __all__ = ["test"]
4
4
 
5
5
 
6
- def test() -> unittest.TextTestRunner:
6
+ def test() -> unittest.TextTestResult:
7
7
  "This function runs all the tests."
8
8
  loader: unittest.TestLoader
9
9
  tests: unittest.TestSuite
@@ -3,20 +3,20 @@ from typing import *
3
3
 
4
4
  from raisefunction.core import raisefunction
5
5
 
6
- __all__ = ["TestRaiseFunction"]
6
+ __all__ = ["Test0"]
7
7
 
8
8
 
9
- class TestRaiseFunction(unittest.TestCase):
9
+ class Test0(unittest.TestCase):
10
10
  def test_dispatcher_no_arguments(self: Self) -> None:
11
11
  "Test the dispatcher raises a TypeError with no arguments."
12
- with self.assertRaises(TypeError) as context:
13
- raisefunction()
12
+ with self.assertRaises(TypeError):
13
+ raisefunction() # type: ignore[call-overload]
14
14
  # self.assertIn("requires at least 1 positional argument", str(context.exception))
15
15
 
16
16
  def test_dispatcher_too_many_arguments(self: Self) -> None:
17
17
  "Test the dispatcher raises a TypeError with more than 2 arguments."
18
- with self.assertRaises(TypeError) as context:
19
- raisefunction(1, 2, 3)
18
+ with self.assertRaises(TypeError):
19
+ raisefunction(1, 2, 3) # type: ignore[call-overload]
20
20
  # self.assertIn("takes at most 2 positional arguments", str(context.exception))
21
21
 
22
22
  def test_raise_single_exception(self: Self) -> None:
@@ -24,10 +24,12 @@ class TestRaiseFunction(unittest.TestCase):
24
24
  with self.assertRaises(ValueError):
25
25
  raisefunction(ValueError("Test single exception"))
26
26
 
27
- def test_raise_exception_with_cause(self: Self) -> None:
27
+ def test_raise_exception_with_cause_0(self: Self) -> None:
28
28
  "Test the exception raising overload with a cause."
29
29
  with self.assertRaises(ValueError) as context:
30
- raisefunction(ValueError("Test exception"), TypeError("Cause exception"))
30
+ raisefunction(
31
+ ValueError("Test exception"), TypeError("Cause exception")
32
+ )
31
33
  self.assertEqual(str(context.exception), "Test exception")
32
34
  self.assertIsInstance(context.exception.__cause__, TypeError)
33
35
  self.assertEqual(str(context.exception.__cause__), "Cause exception")
@@ -35,14 +37,16 @@ class TestRaiseFunction(unittest.TestCase):
35
37
  def test_invalid_arguments_in_overloads(self: Self) -> None:
36
38
  "Test invalid argument types raise appropriate errors."
37
39
  with self.assertRaises(TypeError):
38
- raisefunction("not an exception")
40
+ raisefunction("not an exception") # type: ignore[call-overload]
39
41
  with self.assertRaises(TypeError):
40
- raisefunction("not an exception", "not a cause")
42
+ raisefunction("not an exception", "not a cause") # type: ignore[call-overload]
41
43
 
42
44
  def test_raise_exception_with_cause(self: Self) -> None:
43
45
  "Test the exception raising overload with a cause."
44
46
  with self.assertRaises(ValueError) as context:
45
- raisefunction(ValueError("Test exception"), KeyError("Cause exception"))
47
+ raisefunction(
48
+ ValueError("Test exception"), KeyError("Cause exception")
49
+ )
46
50
  self.assertEqual(str(context.exception), "Test exception")
47
51
  self.assertIsInstance(context.exception.__cause__, KeyError)
48
52
 
@@ -0,0 +1,66 @@
1
+ import unittest
2
+ from typing import *
3
+
4
+ from raisefunction import core
5
+
6
+ __all__ = ["Test1"]
7
+
8
+
9
+ class Test1(unittest.TestCase):
10
+ def test_raises_given_exception_instance_without_cause(self: Self) -> None:
11
+ exc: ValueError
12
+ exc = ValueError("boom")
13
+
14
+ with self.assertRaises(ValueError) as cm:
15
+ core.raisefunction(exc)
16
+
17
+ self.assertIs(cm.exception, exc)
18
+ # When no explicit cause is given, __cause__ is normally None
19
+ # and __context__ may or may not be set depending on context.
20
+ self.assertIsNone(cm.exception.__cause__)
21
+
22
+ def test_raises_given_exception_class_without_cause(self: Self) -> None:
23
+ # Using a class mirrors: raise ValueError
24
+ with self.assertRaises(ValueError) as cm:
25
+ core.raisefunction(ValueError)
26
+ self.assertIsInstance(cm.exception, ValueError)
27
+ self.assertIsNone(cm.exception.__cause__)
28
+
29
+ def test_raises_with_explicit_cause(self: Self) -> None:
30
+ cause: RuntimeError
31
+ exc: ValueError
32
+ cause = RuntimeError("original")
33
+ exc = ValueError("wrapped")
34
+
35
+ with self.assertRaises(ValueError) as cm:
36
+ core.raisefunction(exc, cause)
37
+
38
+ self.assertIs(cm.exception.__cause__, cause)
39
+
40
+ def test_raises_with_suppressed_context_when_cause_is_none(
41
+ self: Self,
42
+ ) -> None:
43
+ exc: ValueError
44
+ exc = ValueError("no context")
45
+
46
+ # Explicit `from None` should result in __cause__ being None,
47
+ # and suppress linking to any active exception.
48
+ with self.assertRaises(ValueError) as cm:
49
+ core.raisefunction(exc, None)
50
+
51
+ self.assertIsNone(cm.exception.__cause__)
52
+
53
+ def test_raising_class_that_requires_args_produces_type_error(
54
+ self: Self,
55
+ ) -> None:
56
+ class NeedsArg(Exception):
57
+ def __init__(self: Self, msg: str) -> None:
58
+ super().__init__(msg)
59
+
60
+ # This mirrors normal `raise NeedsArg` behaviour
61
+ with self.assertRaises(TypeError):
62
+ core.raisefunction(NeedsArg)
63
+
64
+
65
+ if __name__ == "__main__":
66
+ unittest.main()
@@ -0,0 +1,78 @@
1
+ import unittest
2
+ from typing import *
3
+
4
+ from raisefunction import core
5
+
6
+ __all__ = ["Test2"]
7
+
8
+
9
+ class Test2(unittest.TestCase):
10
+ def test_raises_given_exception_instance_without_cause(self: Self) -> None:
11
+ cm: Any
12
+ exc: ValueError
13
+ exc = ValueError("boom")
14
+
15
+ with self.assertRaises(ValueError) as cm:
16
+ core.raisefunction(exc)
17
+
18
+ self.assertIs(cm.exception, exc)
19
+ # When no explicit cause is given, __cause__ is normally None.
20
+ # __context__ may or may not be set depending on context.
21
+ self.assertIsNone(cm.exception.__cause__)
22
+
23
+ def test_raises_given_exception_class_without_cause(self: Self) -> None:
24
+ cm: Any
25
+ with self.assertRaises(ValueError) as cm:
26
+ core.raisefunction(ValueError)
27
+
28
+ self.assertIsInstance(cm.exception, ValueError)
29
+ self.assertIsNone(cm.exception.__cause__)
30
+
31
+ def test_raises_with_explicit_cause(self: Self) -> None:
32
+ cause: RuntimeError
33
+ cm: Any
34
+ exc: ValueError
35
+ cause = RuntimeError("original")
36
+ exc = ValueError("wrapped")
37
+
38
+ with self.assertRaises(ValueError) as cm:
39
+ core.raisefunction(exc, cause)
40
+
41
+ self.assertIs(cm.exception.__cause__, cause)
42
+
43
+ def test_raise_from_None(self: Self) -> None:
44
+ cm: Any
45
+ exc: ValueError
46
+ one: int
47
+ zero: int
48
+
49
+ exc = ValueError("no context")
50
+ with self.assertRaises(ValueError) as cm:
51
+ try:
52
+ # Create a real context exception
53
+ one = 1
54
+ zero = 0
55
+ one / zero
56
+ except ZeroDivisionError:
57
+ raise exc from None
58
+ self.assertIsNone(cm.exception.__cause__)
59
+ self.assertIsInstance(cm.exception.__context__, ZeroDivisionError)
60
+ self.assertTrue(cm.exception.__suppress_context__)
61
+
62
+ def test_raising_class_that_requires_args_produces_type_error(
63
+ self: Self,
64
+ ) -> None:
65
+ class NeedsArg(Exception):
66
+ def __init__(self: Self, msg: str) -> None:
67
+ super().__init__(msg)
68
+
69
+ cm: Any
70
+ with self.assertRaises(TypeError) as cm:
71
+ core.raisefunction(NeedsArg)
72
+
73
+ # Optional: sanity check on the error type/message
74
+ self.assertIsInstance(cm.exception, TypeError)
75
+
76
+
77
+ if __name__ == "__main__":
78
+ unittest.main()
@@ -0,0 +1,42 @@
1
+ import unittest
2
+ from typing import *
3
+
4
+ from raisefunction import core
5
+
6
+ __all__ = ["Test3"]
7
+
8
+
9
+ class Test3(unittest.TestCase):
10
+
11
+ def go(self: Self, *, use_func: bool) -> None:
12
+ cm: Any
13
+ exc: ValueError
14
+ exc = ValueError("no context")
15
+ with self.assertRaises(ValueError) as cm:
16
+ self.go_with(use_func=use_func, exc=exc)
17
+ self.assertIsNone(cm.exception.__cause__)
18
+ self.assertIsInstance(cm.exception.__context__, ZeroDivisionError)
19
+ self.assertTrue(cm.exception.__suppress_context__)
20
+
21
+ def go_with(self: Self, *, use_func: bool, exc: Exception) -> None:
22
+ one: int
23
+ zero: int
24
+ try:
25
+ # Create a real context exception
26
+ one = 1
27
+ zero = 0
28
+ one / zero
29
+ except ZeroDivisionError:
30
+ # This should behave like: raise exc from None
31
+ if use_func:
32
+ core.raisefunction(exc, None)
33
+ else:
34
+ raise exc from None
35
+
36
+ def test_raise_from_None(self: Self) -> None:
37
+ self.go(use_func=False)
38
+ self.go(use_func=True)
39
+
40
+
41
+ if __name__ == "__main__":
42
+ unittest.main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: raisefunction
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: This project provides a function that raises errors passed to it.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -24,6 +24,7 @@ License: The MIT License (MIT)
24
24
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
+
27
28
  Project-URL: Download, https://pypi.org/project/raisefunction/#files
28
29
  Project-URL: Index, https://pypi.org/project/raisefunction/
29
30
  Project-URL: Source, https://github.com/johannes-programming/raisefunction/
@@ -42,8 +43,10 @@ Description-Content-Type: text/x-rst
42
43
  License-File: LICENSE.txt
43
44
  Dynamic: license-file
44
45
 
45
- =============
46
- raisefunction
47
- =============
46
+ ====
47
+ v440
48
+ ====
48
49
 
49
- Visit the website `https://raisefunction.johannes-programming.online/ <https://raisefunction.johannes-programming.online/>`_ for more information.
50
+ Each minor version has its own documentation.
51
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
52
+ They can also be viewed on the website `https://raisefunction.johannes-programming.online/ <https://raisefunction.johannes-programming.online/>`_.
@@ -3,11 +3,17 @@ MANIFEST.in
3
3
  README.rst
4
4
  pyproject.toml
5
5
  setup.cfg
6
+ docs/v1.0.rst
7
+ docs/v1.1.rst
6
8
  src/raisefunction/__init__.py
9
+ src/raisefunction/py.typed
7
10
  src/raisefunction.egg-info/PKG-INFO
8
11
  src/raisefunction.egg-info/SOURCES.txt
9
12
  src/raisefunction.egg-info/dependency_links.txt
10
13
  src/raisefunction.egg-info/top_level.txt
11
14
  src/raisefunction/core/__init__.py
12
15
  src/raisefunction/tests/__init__.py
13
- src/raisefunction/tests/test_0.py
16
+ src/raisefunction/tests/test_0.py
17
+ src/raisefunction/tests/test_1.py
18
+ src/raisefunction/tests/test_2.py
19
+ src/raisefunction/tests/test_3.py
@@ -1,5 +0,0 @@
1
- =============
2
- raisefunction
3
- =============
4
-
5
- Visit the website `https://raisefunction.johannes-programming.online/ <https://raisefunction.johannes-programming.online/>`_ for more information.
@@ -1,5 +0,0 @@
1
- from raisefunction.core import *
2
- from raisefunction.tests import *
3
-
4
- if __name__ == "__main__":
5
- main()
@@ -1,22 +0,0 @@
1
- from typing import *
2
-
3
- __all__ = ["raisefunction"]
4
-
5
- DEFAULT = object()
6
-
7
-
8
- @overload
9
- def raisefunction(exc: BaseException) -> None: ...
10
- @overload
11
- def raisefunction(exc: BaseException, cause: Optional[BaseException]) -> None: ...
12
-
13
-
14
- def raisefunction(
15
- exc: BaseException,
16
- cause: Optional[BaseException] | object = DEFAULT,
17
- ) -> Never:
18
- "This function raises the given exception."
19
- if cause is DEFAULT:
20
- raise exc
21
- else:
22
- raise exc from cause
File without changes