requiresthat 2025.6.20.0__py3-none-any.whl → 2025.6.22.0__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.
- requiresthat/_exceptions.py +6 -2
- requiresthat/_requires.py +9 -3
- {requiresthat-2025.6.20.0.dist-info → requiresthat-2025.6.22.0.dist-info}/METADATA +1 -1
- requiresthat-2025.6.22.0.dist-info/RECORD +8 -0
- requiresthat-2025.6.20.0.dist-info/RECORD +0 -8
- {requiresthat-2025.6.20.0.dist-info → requiresthat-2025.6.22.0.dist-info}/WHEEL +0 -0
- {requiresthat-2025.6.20.0.dist-info → requiresthat-2025.6.22.0.dist-info}/top_level.txt +0 -0
requiresthat/_exceptions.py
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
import textwrap
|
2
2
|
|
3
|
-
class
|
3
|
+
class RequirementError(Exception):
|
4
|
+
"""Base class for all exceptions that follow here"""
|
5
|
+
pass
|
6
|
+
|
7
|
+
class RequirementNotFulfilledError(RequirementError):
|
4
8
|
"""Raise this when a requirement is found wanting"""
|
5
9
|
|
6
10
|
def __init__(self, that, when, subwhen: str = str(), msg=None):
|
@@ -15,7 +19,7 @@ class RequirementNotFulfilledError(Exception):
|
|
15
19
|
# Call the base class' constructor to init the exception class
|
16
20
|
super().__init__(msg or self.default_msg)
|
17
21
|
|
18
|
-
class NoCallableConstructError(
|
22
|
+
class NoCallableConstructError(RequirementError):
|
19
23
|
"""Raise this when a construct is not callable"""
|
20
24
|
|
21
25
|
def __init__(self, construct, msg=None):
|
requiresthat/_requires.py
CHANGED
@@ -80,8 +80,14 @@ def __assert(self, that, when: When, subwhen: str = str()):
|
|
80
80
|
The reason we don't use assert here is to avoid the Knuthian dilemma of premature optimisation;
|
81
81
|
namely, that it nukes this useful tool, :-[
|
82
82
|
"""
|
83
|
+
# We map everything that can go wrong to one exception; that way, the user has to deal with only
|
84
|
+
# one catagory of exceptions.
|
85
|
+
failure = RequirementNotFulfilledError(that, when, subwhen)
|
83
86
|
try:
|
84
87
|
if not eval(that):
|
85
|
-
raise
|
86
|
-
except:
|
87
|
-
raise
|
88
|
+
raise failure from None
|
89
|
+
except Exception:
|
90
|
+
raise failure from None
|
91
|
+
else:
|
92
|
+
# Success!
|
93
|
+
pass
|
@@ -0,0 +1,8 @@
|
|
1
|
+
requiresthat/__init__.py,sha256=VTyJru4K2_e7UEa0od6kXU7M8ovfD176GXEXqtNf-nY,154
|
2
|
+
requiresthat/_exceptions.py,sha256=4XuneVKh6HAi9r0exCuGwYa2NcTFgnpWbcFj6ggxBIc,1398
|
3
|
+
requiresthat/_requires.py,sha256=gpMepQ8iMUkrfiplF3NBJcA26u78F3CzOyUNmRM3TVc,3232
|
4
|
+
requiresthat/_when.py,sha256=VoGuvoG9WDEMIPeKnxAsjMTaCMhgSszf4xxa1vLn5aU,299
|
5
|
+
requiresthat-2025.6.22.0.dist-info/METADATA,sha256=IfzXVEEux1_eVv9mrys2rsNjG_gM7Hvc4FajZrNdcls,2072
|
6
|
+
requiresthat-2025.6.22.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
requiresthat-2025.6.22.0.dist-info/top_level.txt,sha256=mUgMTpAG75GYtt5_rVajUyWp-O_1VrrkqRo_hY9L9So,13
|
8
|
+
requiresthat-2025.6.22.0.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
requiresthat/__init__.py,sha256=VTyJru4K2_e7UEa0od6kXU7M8ovfD176GXEXqtNf-nY,154
|
2
|
-
requiresthat/_exceptions.py,sha256=kzzbS5F-h4Duj84lx6AXWUBHv56VD9jX8og_gJIvN9c,1282
|
3
|
-
requiresthat/_requires.py,sha256=DzQkzMl12UCtPXmjkwsG1zy93oPSZWUGhB1T7o69Vt0,3066
|
4
|
-
requiresthat/_when.py,sha256=VoGuvoG9WDEMIPeKnxAsjMTaCMhgSszf4xxa1vLn5aU,299
|
5
|
-
requiresthat-2025.6.20.0.dist-info/METADATA,sha256=dI6DS-yxNlCu_BLsxd1A5JnId2wbiCWrHJjtYXVH45o,2072
|
6
|
-
requiresthat-2025.6.20.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
requiresthat-2025.6.20.0.dist-info/top_level.txt,sha256=mUgMTpAG75GYtt5_rVajUyWp-O_1VrrkqRo_hY9L9So,13
|
8
|
-
requiresthat-2025.6.20.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|