jetpytools 1.7.1__py3-none-any.whl → 1.7.2__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.
Potentially problematic release.
This version of jetpytools might be problematic. Click here for more details.
- jetpytools/_metadata.py +1 -1
- jetpytools/enums/base.py +2 -2
- jetpytools/exceptions/base.py +4 -4
- jetpytools/exceptions/generic.py +5 -5
- jetpytools/exceptions/module.py +3 -3
- jetpytools/types/generic.py +8 -7
- jetpytools/utils/file.py +10 -10
- {jetpytools-1.7.1.dist-info → jetpytools-1.7.2.dist-info}/METADATA +1 -1
- {jetpytools-1.7.1.dist-info → jetpytools-1.7.2.dist-info}/RECORD +11 -11
- {jetpytools-1.7.1.dist-info → jetpytools-1.7.2.dist-info}/WHEEL +0 -0
- {jetpytools-1.7.1.dist-info → jetpytools-1.7.2.dist-info}/licenses/LICENSE +0 -0
jetpytools/_metadata.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Collection of stuff that's useful in general python programming"""
|
|
2
2
|
|
|
3
|
-
__version__ = "1.7.
|
|
3
|
+
__version__ = "1.7.2"
|
|
4
4
|
|
|
5
5
|
__author_name__, __author_email__ = "Jaded Encoding Thaumaturgy", "jaded.encoding.thaumaturgy@gmail.com"
|
|
6
6
|
__maintainer_name__, __maintainer_email__ = __author_name__, __author_email__
|
jetpytools/enums/base.py
CHANGED
|
@@ -6,7 +6,7 @@ from typing import Any
|
|
|
6
6
|
from typing_extensions import Self
|
|
7
7
|
|
|
8
8
|
from ..exceptions import CustomValueError, NotFoundEnumValue
|
|
9
|
-
from ..types import
|
|
9
|
+
from ..types import FuncExcept
|
|
10
10
|
|
|
11
11
|
__all__ = ["CustomEnum", "CustomIntEnum", "CustomStrEnum"]
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ class CustomEnum(Enum):
|
|
|
19
19
|
return cls.from_param(value)
|
|
20
20
|
|
|
21
21
|
@classmethod
|
|
22
|
-
def from_param(cls, value: Any, func_except:
|
|
22
|
+
def from_param(cls, value: Any, func_except: FuncExcept | None = None) -> Self | None:
|
|
23
23
|
"""
|
|
24
24
|
Return the enum value from a parameter.
|
|
25
25
|
|
jetpytools/exceptions/base.py
CHANGED
|
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
|
|
8
8
|
|
|
9
9
|
from typing_extensions import Self
|
|
10
10
|
|
|
11
|
-
from ..types import MISSING,
|
|
11
|
+
from ..types import MISSING, FuncExcept, MissingT, SupportsString
|
|
12
12
|
|
|
13
13
|
__all__ = [
|
|
14
14
|
"CustomError",
|
|
@@ -80,7 +80,7 @@ class CustomError(ExceptionError, metaclass=CustomErrorMeta):
|
|
|
80
80
|
"""Custom base exception class."""
|
|
81
81
|
|
|
82
82
|
def __init__(
|
|
83
|
-
self, message: SupportsString | None = None, func:
|
|
83
|
+
self, message: SupportsString | None = None, func: FuncExcept | None = None, reason: Any = None, **kwargs: Any
|
|
84
84
|
) -> None:
|
|
85
85
|
"""
|
|
86
86
|
Instantiate a new exception with pretty printing and more.
|
|
@@ -107,8 +107,8 @@ class CustomError(ExceptionError, metaclass=CustomErrorMeta):
|
|
|
107
107
|
def __call__(
|
|
108
108
|
self,
|
|
109
109
|
message: SupportsString | None | MissingT = MISSING,
|
|
110
|
-
func:
|
|
111
|
-
reason: SupportsString |
|
|
110
|
+
func: FuncExcept | None | MissingT = MISSING,
|
|
111
|
+
reason: SupportsString | FuncExcept | None | MissingT = MISSING,
|
|
112
112
|
**kwargs: Any,
|
|
113
113
|
) -> Self:
|
|
114
114
|
"""
|
jetpytools/exceptions/generic.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import Any, Iterable
|
|
4
4
|
|
|
5
|
-
from ..types import
|
|
5
|
+
from ..types import FuncExcept, SupportsString, T
|
|
6
6
|
from .base import CustomValueError
|
|
7
7
|
|
|
8
8
|
__all__ = ["MismatchError", "MismatchRefError"]
|
|
@@ -21,7 +21,7 @@ class MismatchError(CustomValueError):
|
|
|
21
21
|
|
|
22
22
|
def __init__(
|
|
23
23
|
self,
|
|
24
|
-
func:
|
|
24
|
+
func: FuncExcept,
|
|
25
25
|
items: Iterable[Any],
|
|
26
26
|
message: SupportsString = "All items must be equal!",
|
|
27
27
|
reason: Any = "{reduced_items}",
|
|
@@ -30,18 +30,18 @@ class MismatchError(CustomValueError):
|
|
|
30
30
|
super().__init__(message, func, reason, **kwargs, reduced_items=iter(self._reduce(items)))
|
|
31
31
|
|
|
32
32
|
@classmethod
|
|
33
|
-
def check(cls, func:
|
|
33
|
+
def check(cls, func: FuncExcept, /, *items: Any, **kwargs: Any) -> None:
|
|
34
34
|
if len(cls._reduce(items)) != 1:
|
|
35
35
|
raise cls(func, items, **kwargs)
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class MismatchRefError(MismatchError):
|
|
39
39
|
def __init__(
|
|
40
|
-
self, func:
|
|
40
|
+
self, func: FuncExcept, base: T, ref: T, message: SupportsString = "All items must be equal!", **kwargs: Any
|
|
41
41
|
) -> None:
|
|
42
42
|
super().__init__(func, [base, ref], message, **kwargs)
|
|
43
43
|
|
|
44
44
|
@classmethod
|
|
45
|
-
def check(cls, func:
|
|
45
|
+
def check(cls, func: FuncExcept, /, *items: Any, **kwargs: Any) -> None:
|
|
46
46
|
if len(cls._reduce(items)) != 1:
|
|
47
47
|
raise cls(func, *items, **kwargs)
|
jetpytools/exceptions/module.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
|
-
from ..types import
|
|
5
|
+
from ..types import FuncExcept, SupportsString
|
|
6
6
|
from .base import CustomError
|
|
7
7
|
|
|
8
8
|
__all__ = ["CustomImportError", "DependencyNotFoundError"]
|
|
@@ -13,7 +13,7 @@ class CustomImportError(CustomError, ImportError):
|
|
|
13
13
|
|
|
14
14
|
def __init__(
|
|
15
15
|
self,
|
|
16
|
-
func:
|
|
16
|
+
func: FuncExcept,
|
|
17
17
|
package: str | ImportError,
|
|
18
18
|
message: SupportsString = "Import failed for package '{package}'!",
|
|
19
19
|
**kwargs: Any,
|
|
@@ -32,7 +32,7 @@ class DependencyNotFoundError(CustomImportError):
|
|
|
32
32
|
|
|
33
33
|
def __init__(
|
|
34
34
|
self,
|
|
35
|
-
func:
|
|
35
|
+
func: FuncExcept,
|
|
36
36
|
package: str | ImportError,
|
|
37
37
|
message: SupportsString = "Missing dependency '{package}'!",
|
|
38
38
|
**kwargs: Any,
|
jetpytools/types/generic.py
CHANGED
|
@@ -6,23 +6,23 @@ from typing import Any, Callable, Literal, TypeAlias, Union
|
|
|
6
6
|
from .builtins import F, SingleOrArr, SingleOrArrOpt
|
|
7
7
|
from .supports import SupportsString
|
|
8
8
|
|
|
9
|
-
__all__ = ["MISSING", "DataType", "
|
|
9
|
+
__all__ = ["MISSING", "DataType", "FuncExcept", "MissingT", "PassthroughC", "StrArr", "StrArrOpt"]
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
13
|
-
|
|
12
|
+
class _MissingType(Enum):
|
|
13
|
+
MISSING = auto()
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
MissingT: TypeAlias = Literal[
|
|
17
|
-
MISSING =
|
|
16
|
+
MissingT: TypeAlias = Literal[_MissingType.MISSING]
|
|
17
|
+
MISSING = _MissingType.MISSING
|
|
18
18
|
|
|
19
19
|
DataType = Union[str, bytes, bytearray, SupportsString]
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
FuncExcept = str | Callable[..., Any] | tuple[Callable[..., Any] | str, str]
|
|
22
22
|
"""
|
|
23
23
|
This type is used in specific functions that can throw an exception.
|
|
24
24
|
```
|
|
25
|
-
def can_throw(..., *, func:
|
|
25
|
+
def can_throw(..., *, func: FuncExcept) -> None:
|
|
26
26
|
...
|
|
27
27
|
if some_error:
|
|
28
28
|
raise CustomValueError('Some error occurred!!', func)
|
|
@@ -35,6 +35,7 @@ If an error occurs, this will print a clear error ->\n
|
|
|
35
35
|
``ValueError: (some_func) Some error occurred!!``
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
+
FuncExceptT = FuncExcept
|
|
38
39
|
|
|
39
40
|
StrArr = SingleOrArr[SupportsString]
|
|
40
41
|
StrArrOpt = SingleOrArrOpt[SupportsString]
|
jetpytools/utils/file.py
CHANGED
|
@@ -11,7 +11,7 @@ from ..exceptions import FileIsADirectoryError, FileNotExistsError, FilePermissi
|
|
|
11
11
|
from ..types import (
|
|
12
12
|
FileOpener,
|
|
13
13
|
FilePathType,
|
|
14
|
-
|
|
14
|
+
FuncExcept,
|
|
15
15
|
OpenBinaryMode,
|
|
16
16
|
OpenBinaryModeReading,
|
|
17
17
|
OpenBinaryModeUpdating,
|
|
@@ -73,7 +73,7 @@ def get_user_data_dir() -> Path:
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
def check_perms(
|
|
76
|
-
file: FilePathType, mode: OpenTextMode | OpenBinaryMode, strict: bool = False, *, func:
|
|
76
|
+
file: FilePathType, mode: OpenTextMode | OpenBinaryMode, strict: bool = False, *, func: FuncExcept | None = None
|
|
77
77
|
) -> bool:
|
|
78
78
|
"""
|
|
79
79
|
Confirm whether the user has write/read access to a file.
|
|
@@ -140,7 +140,7 @@ def open_file(
|
|
|
140
140
|
errors: str | None = ...,
|
|
141
141
|
newline: str | None = ...,
|
|
142
142
|
*,
|
|
143
|
-
func:
|
|
143
|
+
func: FuncExcept | None = None,
|
|
144
144
|
) -> TextIOWrapper: ...
|
|
145
145
|
|
|
146
146
|
|
|
@@ -151,7 +151,7 @@ def open_file(
|
|
|
151
151
|
buffering: Literal[0],
|
|
152
152
|
encoding: None = None,
|
|
153
153
|
*,
|
|
154
|
-
func:
|
|
154
|
+
func: FuncExcept | None = None,
|
|
155
155
|
) -> FileIO: ...
|
|
156
156
|
|
|
157
157
|
|
|
@@ -162,7 +162,7 @@ def open_file(
|
|
|
162
162
|
buffering: Literal[-1, 1] = ...,
|
|
163
163
|
encoding: None = None,
|
|
164
164
|
*,
|
|
165
|
-
func:
|
|
165
|
+
func: FuncExcept | None = None,
|
|
166
166
|
) -> BufferedRandom: ...
|
|
167
167
|
|
|
168
168
|
|
|
@@ -173,7 +173,7 @@ def open_file(
|
|
|
173
173
|
buffering: Literal[-1, 1] = ...,
|
|
174
174
|
encoding: None = None,
|
|
175
175
|
*,
|
|
176
|
-
func:
|
|
176
|
+
func: FuncExcept | None = None,
|
|
177
177
|
) -> BufferedWriter: ...
|
|
178
178
|
|
|
179
179
|
|
|
@@ -184,7 +184,7 @@ def open_file(
|
|
|
184
184
|
buffering: Literal[-1, 1] = ...,
|
|
185
185
|
encoding: None = None,
|
|
186
186
|
*,
|
|
187
|
-
func:
|
|
187
|
+
func: FuncExcept | None = None,
|
|
188
188
|
) -> BufferedReader: ...
|
|
189
189
|
|
|
190
190
|
|
|
@@ -195,7 +195,7 @@ def open_file(
|
|
|
195
195
|
buffering: int = ...,
|
|
196
196
|
encoding: None = None,
|
|
197
197
|
*,
|
|
198
|
-
func:
|
|
198
|
+
func: FuncExcept | None = None,
|
|
199
199
|
) -> BinaryIO: ...
|
|
200
200
|
|
|
201
201
|
|
|
@@ -210,11 +210,11 @@ def open_file(
|
|
|
210
210
|
closefd: bool = ...,
|
|
211
211
|
opener: FileOpener | None = ...,
|
|
212
212
|
*,
|
|
213
|
-
func:
|
|
213
|
+
func: FuncExcept | None = None,
|
|
214
214
|
) -> IO[Any]: ...
|
|
215
215
|
|
|
216
216
|
|
|
217
|
-
def open_file(file: FilePathType, mode: Any = "r+", *args: Any, func:
|
|
217
|
+
def open_file(file: FilePathType, mode: Any = "r+", *args: Any, func: FuncExcept | None = None, **kwargs: Any) -> Any:
|
|
218
218
|
"""
|
|
219
219
|
Open file and return a stream. Raise OSError upon failure.
|
|
220
220
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jetpytools
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.2
|
|
4
4
|
Summary: Collection of stuff that's useful in general python programming
|
|
5
5
|
Project-URL: Source Code, https://github.com/Jaded-Encoding-Thaumaturgy/jetpytools
|
|
6
6
|
Project-URL: Contact, https://discord.gg/XTpc6Fa9eB
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
jetpytools/__init__.py,sha256=ha_pCOMqfeIbipDRrtqKOqH3NQEpX4KwN2SskpsCGb4,114
|
|
2
|
-
jetpytools/_metadata.py,sha256=
|
|
2
|
+
jetpytools/_metadata.py,sha256=1gq8Xhbmpvzz3wxNKv9JFIJ9qn3tzlccU0sOEbmUkUU,414
|
|
3
3
|
jetpytools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
jetpytools/enums/__init__.py,sha256=TvEt3TWmnzf2TWS_Gd6llyyXAGDKxdhdJsDgSvT7xys,41
|
|
5
|
-
jetpytools/enums/base.py,sha256=
|
|
5
|
+
jetpytools/enums/base.py,sha256=s5A9iQS22JdaZMM6jEXI31m0ZjtBx7GLQ-E0xBr90Zc,2032
|
|
6
6
|
jetpytools/enums/other.py,sha256=9GGRS4P-P589C1HqNpDDBhLdphID1trwCJi7pbXT0iM,1317
|
|
7
7
|
jetpytools/exceptions/__init__.py,sha256=0rNEfnOuoSRUyKsutGzHFWQkgiFaK7diOT4VbRVKt9c,105
|
|
8
|
-
jetpytools/exceptions/base.py,sha256=
|
|
8
|
+
jetpytools/exceptions/base.py,sha256=4DNDYlH_196sZH9_B-mvs4pRxr2kcO3JSwDBmAaRT8o,7645
|
|
9
9
|
jetpytools/exceptions/enum.py,sha256=euR6cyMetVWSfTgO5rkblhQyEgusdwhx6Rd9I5ZoFbA,293
|
|
10
10
|
jetpytools/exceptions/file.py,sha256=7Eh4aPo4r1W-ppnf6XLwWaStOSjIxw9JfzOCa4W7m8E,1105
|
|
11
|
-
jetpytools/exceptions/generic.py,sha256=
|
|
12
|
-
jetpytools/exceptions/module.py,sha256=
|
|
11
|
+
jetpytools/exceptions/generic.py,sha256=91U6RoiAoejFOU2qjaJsmej8FhC0XXQuZ535XTi1qGA,1504
|
|
12
|
+
jetpytools/exceptions/module.py,sha256=iRKvbxa59MYDavIQIzPR-NjqjhZbBTLRvzAONMXs3Aw,1228
|
|
13
13
|
jetpytools/functions/__init__.py,sha256=jCw3-aaOGxIzi6iyFInWPOxOFbzZg8IZhoSuGYaNgLA,67
|
|
14
14
|
jetpytools/functions/funcs.py,sha256=lcdWaJtslhXZNfNu_y-Badgz2uy0bVaoA3D_lLo_GNI,5286
|
|
15
15
|
jetpytools/functions/normalize.py,sha256=czliT8iyYPdiJG3C7wHppFrOxeVP5OOWZGdRPHFvEi8,8594
|
|
@@ -19,15 +19,15 @@ jetpytools/types/builtins.py,sha256=4uAutpHlkcKM3K_6BbWomqR2QgWNt6294FHE3Ck_ZIA,
|
|
|
19
19
|
jetpytools/types/check.py,sha256=ktQOykmryUkDa2j-zcL6uEWF8QlxJ4GW8YKdbqMHGcc,959
|
|
20
20
|
jetpytools/types/file.py,sha256=LbOwMAwDALWxAZZ2i7ZNexoN3GHWD-uUoIhVvUy95Vo,6539
|
|
21
21
|
jetpytools/types/funcs.py,sha256=U5tBmTtLS5CLp3ZtOiA5101PQiCWQOBsmf0bj1pRwgY,2778
|
|
22
|
-
jetpytools/types/generic.py,sha256=
|
|
22
|
+
jetpytools/types/generic.py,sha256=yCavU0bBXGh15-PxIlQE78xj05kpxMVTAGI7xAoon2Y,1121
|
|
23
23
|
jetpytools/types/supports.py,sha256=woMTv62HpcRiC5TG18U8NU5v2Q6iqcrHzQgXl7QYEws,3516
|
|
24
24
|
jetpytools/types/utils.py,sha256=tIN6OdjrwHxb8XyQeptWh4YbOKdABPOZkKpONZ7eAv8,22877
|
|
25
25
|
jetpytools/utils/__init__.py,sha256=_rJ-mY5PsGjBfy8Fihx_FYJfAIGSrYAYzI6Td9oFh9A,83
|
|
26
|
-
jetpytools/utils/file.py,sha256=
|
|
26
|
+
jetpytools/utils/file.py,sha256=uJV8_S-ctu9Ya9ZR8Kp4QFZ6R62_PnaxAzsiAj2xFIE,10568
|
|
27
27
|
jetpytools/utils/funcs.py,sha256=2qhFyLD0OLvenjzOu2wu1ZWoZGzQ8aPmvbkAI1i9Gvk,914
|
|
28
28
|
jetpytools/utils/math.py,sha256=I56OeHDDJl3X8EFXMWVEiXGAD16AKcn8KVnFuP5fFes,3445
|
|
29
29
|
jetpytools/utils/ranges.py,sha256=glxypgmuzauV6KCSNujNHOdWkNEUNylOUAPS618jnIg,2559
|
|
30
|
-
jetpytools-1.7.
|
|
31
|
-
jetpytools-1.7.
|
|
32
|
-
jetpytools-1.7.
|
|
33
|
-
jetpytools-1.7.
|
|
30
|
+
jetpytools-1.7.2.dist-info/METADATA,sha256=LN7XIprsH4za_VaporgeHwpwCPeBvmOOzjZeaHz9kl0,1198
|
|
31
|
+
jetpytools-1.7.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
32
|
+
jetpytools-1.7.2.dist-info/licenses/LICENSE,sha256=l0PN-qDtXcgOB5aXP_nSUsvCK5V3o9pQCGsTzyZhKL0,1071
|
|
33
|
+
jetpytools-1.7.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|