Strave 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.
modules/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ from types import SimpleNamespace
2
+
3
+ from .module_error import error
4
+ from .module_warning import warning
5
+
6
+ strave = SimpleNamespace(error=error, warning=warning)
@@ -0,0 +1,249 @@
1
+ import sys
2
+ from time import sleep
3
+
4
+
5
+ def handle_TypeError(message, fatal: bool, delay: int | float = 0):
6
+ if delay:
7
+ sleep(delay)
8
+ if fatal is True:
9
+ print(f"TypeError(Fatal) -> {message}")
10
+ sys.exit(1)
11
+ print(f"TypeError -> {message}")
12
+
13
+
14
+ def handle_SyntaxError(message, fatal: bool, delay: int | float = 0):
15
+ if delay:
16
+ sleep(delay)
17
+ if fatal is True:
18
+ print(f"SyntaxError(Fatal) -> {message}")
19
+ sys.exit(1)
20
+ print(f"SyntaxError -> {message}")
21
+
22
+
23
+ def handle_ValueError(message, fatal: bool, delay: int | float = 0):
24
+ if delay:
25
+ sleep(delay)
26
+ if fatal is True:
27
+ print(f"ValueError(Fatal) -> {message}")
28
+ sys.exit(1)
29
+ print(f"ValueError -> {message}")
30
+
31
+
32
+ def handle_NameError(message, fatal: bool, delay: int | float = 0):
33
+ if delay:
34
+ sleep(delay)
35
+ if fatal is True:
36
+ print(f"NameError(Fatal) -> {message}")
37
+ sys.exit(1)
38
+ print(f"NameError -> {message}")
39
+
40
+
41
+ def handle_IndexError(message, fatal: bool, delay: int | float = 0):
42
+ if delay:
43
+ sleep(delay)
44
+ if fatal is True:
45
+ print(f"IndexError(Fatal) -> {message}")
46
+ sys.exit(1)
47
+ print(f"IndexError -> {message}")
48
+
49
+
50
+ def handle_KeyError(message, fatal: bool, delay: int | float = 0):
51
+ if delay:
52
+ sleep(delay)
53
+ if fatal is True:
54
+ print(f"KeyError(Fatal) -> {message}")
55
+ sys.exit(1)
56
+ print(f"KeyError -> {message}")
57
+
58
+
59
+ def handle_AttributeError(message, fatal: bool, delay: int | float = 0):
60
+ if delay:
61
+ sleep(delay)
62
+ if fatal is True:
63
+ print(f"AttributeError(Fatal) -> {message}")
64
+ sys.exit(1)
65
+ print(f"AttributeError -> {message}")
66
+
67
+
68
+ def handle_IndentationError(message, fatal: bool, delay: int | float = 0):
69
+ if delay:
70
+ sleep(delay)
71
+ if fatal is True:
72
+ print(f"IndentationError(Fatal) -> {message}")
73
+ sys.exit(1)
74
+ print(f"IdentationError -> {message}")
75
+
76
+
77
+ def handle_FileNotFoundError(message, fatal: bool, delay: int | float = 0):
78
+ if delay:
79
+ sleep(delay)
80
+ if fatal is True:
81
+ print(f"FileNotFoundError(Fatal) -> {message}")
82
+ sys.exit(1)
83
+ print(f"FileNotFoundError -> {message}")
84
+
85
+
86
+ def handle_ZeroDivisionError(message, fatal: bool, delay: int | float = 0):
87
+ if delay:
88
+ sleep(delay)
89
+ if fatal is True:
90
+ print(f"ZeroDivisionError(Fatal) -> {message}")
91
+ sys.exit(1)
92
+ print(f"ZeroDivsionError -> {message}")
93
+
94
+
95
+ def handle_ImportError(message, fatal: bool, delay: int | float = 0):
96
+ if delay:
97
+ sleep(delay)
98
+ if fatal is True:
99
+ print(f"ImportError(Fatal) -> {message}")
100
+ sys.exit(1)
101
+ print(f"ImportError -> {message}")
102
+
103
+
104
+ def handle_OverflowError(message, fatal: bool, delay: int | float = 0):
105
+ if delay:
106
+ sleep(delay)
107
+ if fatal is True:
108
+ print(f"OverflowError(Fatal) -> {message}")
109
+ sys.exit(0)
110
+ print(f"OverflowError -> {message}")
111
+
112
+
113
+ def handle_UnboundLocalError(message, fatal: bool, delay: int | float = 0):
114
+ if delay:
115
+ sleep(delay)
116
+ if fatal is True:
117
+ print(f"UnboundLocalError(Fatal) -> {message}")
118
+ sys.exit(1)
119
+ print(f"LocalError -> {message}")
120
+
121
+
122
+ def handle_TimeoutError(message, fatal: bool, delay: int | float = 0):
123
+ if delay:
124
+ sleep(delay)
125
+ if fatal is True:
126
+ print(f"TimeoutError(Fatal) -> {message}")
127
+ sys.exit(1)
128
+ print(f"TimeoutError -> {message}")
129
+
130
+
131
+ def handle_ConnectionError(message, fatal: bool, delay: int | float = 0):
132
+ if delay:
133
+ sleep(delay)
134
+ if fatal is True:
135
+ print(f"ConnectionError(Fatal) -> {message}")
136
+ sys.exit(1)
137
+ print(f"ConnectionError -> {message}")
138
+
139
+
140
+ def handle_PermissionError(message, fatal: bool, delay: int | float = 0):
141
+ if delay:
142
+ sleep(delay)
143
+ if fatal is True:
144
+ print(f"PermissionError(Fatal) -> {message}")
145
+ sys.exit(1)
146
+ print(f"PermissionError -> {message}")
147
+
148
+
149
+ def handle_keyboard_intrupt(message, fatal: bool, delay: int | float = 0):
150
+ if delay:
151
+ sleep(delay)
152
+ if fatal is True:
153
+ print(f"KeyboardIntrupt(Fatal) -> {message}")
154
+ sys.exit(1)
155
+ print(f"KeyboardIntrupt -> {message}")
156
+
157
+
158
+ def handle_ModuleNotFoundError(message, fatal: bool, delay: int | float = 0):
159
+ if delay:
160
+ sleep(delay)
161
+ if fatal is True:
162
+ print(f"ModuleNotFoundError(Fatal) -> {message}")
163
+ sys.exit(1)
164
+ print(f"ModuleNotFoundError -> {message}")
165
+
166
+
167
+ def error(exception_type, custom_message=None, fatal=None, delay: int | float = 0):
168
+ if fatal is None:
169
+ critical_errors = [
170
+ ValueError,
171
+ TypeError,
172
+ SyntaxError,
173
+ NameError,
174
+ IndentationError,
175
+ ModuleNotFoundError,
176
+ ]
177
+ fatal = exception_type in critical_errors
178
+ if exception_type is TypeError:
179
+ if custom_message is None:
180
+ custom_message = "Invalid Data Type Encountered, Try Again."
181
+ handle_TypeError(custom_message, fatal, delay)
182
+ elif exception_type is ValueError:
183
+ if custom_message is None:
184
+ custom_message = "Wrong Value Input, Try Again."
185
+ handle_ValueError(custom_message, fatal, delay)
186
+ elif exception_type is ZeroDivisionError:
187
+ if custom_message is None:
188
+ custom_message = "Cannot Divide with 0(Zero), Try Again."
189
+ handle_ZeroDivisionError(custom_message, fatal, delay)
190
+ elif exception_type is SyntaxError:
191
+ if custom_message is None:
192
+ custom_message = "Invalid Syntax Found, Try Again."
193
+ handle_SyntaxError(custom_message, fatal, delay)
194
+ elif exception_type is NameError:
195
+ if custom_message is None:
196
+ custom_message = "Undefined Variable/Function Found, Try Again."
197
+ handle_NameError(custom_message, fatal, delay)
198
+ elif exception_type is IndexError:
199
+ if custom_message is None:
200
+ custom_message = "Inaccessed List Item Found, Try Again."
201
+ handle_IndexError(custom_message, fatal, delay)
202
+ elif exception_type is KeyError:
203
+ if custom_message is None:
204
+ custom_message = "Unable To Access Dictionary, Try Again."
205
+ handle_KeyError(custom_message, fatal, delay)
206
+ elif exception_type is AttributeError:
207
+ if custom_message is None:
208
+ custom_message = "Unsupported Method, Try Again."
209
+ handle_AttributeError(custom_message, fatal, delay)
210
+ elif exception_type is ImportError:
211
+ if custom_message is None:
212
+ custom_message = "Unreachable Import, Try Again."
213
+ handle_ImportError(custom_message, fatal, delay)
214
+ elif exception_type is ModuleNotFoundError:
215
+ if custom_message is None:
216
+ custom_message = "Unreachable Module, Try Again."
217
+ handle_ModuleNotFoundError(custom_message, fatal, delay)
218
+ elif exception_type is IndentationError:
219
+ if custom_message is None:
220
+ custom_message = "Wrong Indent Found, Try Again."
221
+ handle_IndentationError(custom_message, fatal, delay)
222
+ elif exception_type is FileNotFoundError:
223
+ if custom_message is None:
224
+ custom_message = "Inaccessible File Found, Try Again."
225
+ handle_FileNotFoundError(custom_message, fatal, delay)
226
+ elif exception_type is OverflowError:
227
+ if custom_message is None:
228
+ custom_message = "Math Calculation Exceeded Limits. Try Again."
229
+ handle_OverflowError(custom_message, fatal, delay)
230
+ elif exception_type is UnboundLocalError:
231
+ if custom_message is None:
232
+ custom_message = "Variable Referenced. But Not Assigned, Try Again."
233
+ handle_UnboundLocalError(custom_message, fatal, delay)
234
+ elif exception_type is TimeoutError:
235
+ if custom_message is None:
236
+ custom_message = "Request Took Too long to Respond. Try Again"
237
+ handle_TimeoutError(custom_message, fatal, delay)
238
+ elif exception_type is ConnectionError:
239
+ if custom_message is None:
240
+ custom_message = "Network Requests Failed. Try Again."
241
+ handle_ConnectionError(custom_message, fatal, delay)
242
+ elif exception_type is PermissionError:
243
+ if custom_message is None:
244
+ custom_message = "Access Denied. Check your Permissions"
245
+ handle_PermissionError(custom_message, fatal, delay)
246
+ elif exception_type is KeyboardInterrupt:
247
+ if custom_message is None:
248
+ custom_message = "The Current Process/Script. Has Been Stopped"
249
+ handle_keyboard_intrupt(custom_message, fatal, delay)
@@ -0,0 +1,100 @@
1
+ import sys
2
+
3
+
4
+ def handle_UserWarning(message, fatal: bool, suppress: bool):
5
+ if suppress is True:
6
+ return
7
+ if fatal is True:
8
+ print(f"UserWarning(Fatal) -> {message}")
9
+ sys.exit(1)
10
+ print(f"UserWarning -> {message}")
11
+
12
+
13
+ def handle_SyntaxWarning(message, fatal: bool, suppress: bool):
14
+ if suppress is True:
15
+ return
16
+ if fatal is True:
17
+ print(f"SyntaxWarning(Fatal) -> {message}")
18
+ sys.exit(1)
19
+ print(f"SyntaxWarning -> {message}")
20
+
21
+
22
+ def handle_ResourceWarning(message, fatal: bool, suppress: bool):
23
+ if suppress is True:
24
+ return
25
+ if fatal is True:
26
+ print(f"ResourceWarning(Fatal) -> {message}")
27
+ sys.exit(1)
28
+ print(f"ResourceWarning -> {message}")
29
+
30
+
31
+ def handle_BytesWarning(message, fatal: bool, suppress: bool):
32
+ if suppress is True:
33
+ return
34
+ if fatal is True:
35
+ print(f"BytesWarning(Fatal) -> {message}")
36
+ sys.exit(1)
37
+ print(f"BytesWarning -> {message}")
38
+
39
+
40
+ def handle_DeprecationWarning(message, fatal: bool, suppress: bool):
41
+ if suppress is True:
42
+ return
43
+ if fatal is True:
44
+ print(f"DeprecationWarning(Fatal) -> {message}")
45
+ sys.exit(1)
46
+ print(f"DepricationWarning -> {message}")
47
+
48
+
49
+ def handle_FutureWarning(message, fatal: bool, suppress: bool):
50
+ if suppress is True:
51
+ return
52
+ if fatal is True:
53
+ print(f"FutureWarning(Fatal) -> {message}")
54
+ sys.exit(1)
55
+
56
+ print(f"FutureWarning -> {message}")
57
+
58
+
59
+ def handle_RuntimeWarning(message, fatal: bool, suppress: bool):
60
+ if suppress is True:
61
+ return
62
+ if fatal is True:
63
+ print(f"RuntimeWarning(Fatal) -> {message}")
64
+ sys.exit(1)
65
+ print(f"RuntimeWarning -> {message}")
66
+
67
+
68
+ def warning(exception_type, custom_message, fatal, suppress):
69
+ if exception_type is UserWarning:
70
+ if custom_message is None:
71
+ custom_message = "UserWarning: Bad Code Instance. Technically in Syntax."
72
+ handle_UserWarning(custom_message, fatal, suppress)
73
+ elif exception_type is DeprecationWarning:
74
+ if custom_message is None:
75
+ custom_message = "DeprecationWarning: This Code May be Depreciated(Probably Removed in Past)."
76
+ handle_DeprecationWarning(custom_message, fatal, suppress)
77
+ elif exception_type is FutureWarning:
78
+ if custom_message is None:
79
+ custom_message = (
80
+ "FutureWarning: Feature Behaviour Can Change Future Codebases."
81
+ )
82
+ handle_FutureWarning(custom_message, fatal, suppress)
83
+ elif exception_type is RuntimeWarning:
84
+ if custom_message is None:
85
+ custom_message = "RuntimeWarning: Connection Almost Dropped."
86
+ handle_RuntimeWarning(custom_message, fatal, suppress)
87
+ elif exception_type is BytesWarning:
88
+ if custom_message is None:
89
+ custom_message = (
90
+ "BytesWarning: Unidenified mismatch between bytes and string objects."
91
+ )
92
+ handle_BytesWarning(custom_message, fatal, suppress)
93
+ elif exception_type is ResourceWarning:
94
+ if custom_message is None:
95
+ custom_message = "ResourceWarning: A Resource leaking in the background. Kindly close it."
96
+ handle_ResourceWarning(custom_message, fatal, suppress)
97
+ elif exception_type is SyntaxWarning:
98
+ if custom_message is None:
99
+ custom_message = "SyntaxWarning: Validated But. Highly Questionable code. Check syntax practices."
100
+ handle_SyntaxWarning(custom_message, fatal, suppress)
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: Strave
3
+ Version: 0.1
4
+ Summary: A Simple Error Issuing Library
5
+ Author: PixelVam/Vamdev/Vamcodes
6
+ Requires-Python: >=3.10
7
+ Dynamic: author
8
+ Dynamic: requires-python
9
+ Dynamic: summary
@@ -0,0 +1,7 @@
1
+ modules/__init__.py,sha256=qFcObbIJBmvfuGrObnGXCq1e4zyo00NbRKdwomrxWAU,165
2
+ modules/module_error.py,sha256=9JQ6wL3jexf67rvWCpgeVyrVjes3dB4KaW0V1P4-ZN0,8735
3
+ modules/module_warning.py,sha256=9iQK9M9lm9Xb1a4g_Nire0nT0Up3DYC98bATk4KdFwc,3601
4
+ strave-0.1.dist-info/METADATA,sha256=e6CJ-tcC9BFIpowJKCZmMclifaSamMMqRUeE3g1Ls3A,212
5
+ strave-0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ strave-0.1.dist-info/top_level.txt,sha256=F7U4jdIxH3MVMmyX9rbajWuG0bj5tcZN4L1DZSxW72E,8
7
+ strave-0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ modules