jetpytools 1.7.0__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  """Collection of stuff that's useful in general python programming"""
2
2
 
3
- __version__ = "1.7.0"
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 FuncExceptT
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: FuncExceptT | None = None) -> Self | None:
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
 
@@ -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, FuncExceptT, MissingT, SupportsString
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: FuncExceptT | None = None, reason: Any = None, **kwargs: Any
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: FuncExceptT | None | MissingT = MISSING,
111
- reason: SupportsString | FuncExceptT | None | MissingT = MISSING,
110
+ func: FuncExcept | None | MissingT = MISSING,
111
+ reason: SupportsString | FuncExcept | None | MissingT = MISSING,
112
112
  **kwargs: Any,
113
113
  ) -> Self:
114
114
  """
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Any, Iterable
4
4
 
5
- from ..types import FuncExceptT, SupportsString, T
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: FuncExceptT,
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: FuncExceptT, /, *items: Any, **kwargs: Any) -> None:
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: FuncExceptT, base: T, ref: T, message: SupportsString = "All items must be equal!", **kwargs: Any
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: FuncExceptT, /, *items: Any, **kwargs: Any) -> None:
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)
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Any
4
4
 
5
- from ..types import FuncExceptT, SupportsString
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: FuncExceptT,
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: FuncExceptT,
35
+ func: FuncExcept,
36
36
  package: str | ImportError,
37
37
  message: SupportsString = "Missing dependency '{package}'!",
38
38
  **kwargs: Any,
@@ -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", "FuncExceptT", "MissingT", "PassthroughC", "StrArr", "StrArrOpt"]
9
+ __all__ = ["MISSING", "DataType", "FuncExcept", "MissingT", "PassthroughC", "StrArr", "StrArrOpt"]
10
10
 
11
11
 
12
- class MissingTBase(Enum):
13
- MissingT = auto()
12
+ class _MissingType(Enum):
13
+ MISSING = auto()
14
14
 
15
15
 
16
- MissingT: TypeAlias = Literal[MissingTBase.MissingT]
17
- MISSING = MissingTBase.MissingT
16
+ MissingT: TypeAlias = Literal[_MissingType.MISSING]
17
+ MISSING = _MissingType.MISSING
18
18
 
19
19
  DataType = Union[str, bytes, bytearray, SupportsString]
20
20
 
21
- FuncExceptT = str | Callable[..., Any] | tuple[Callable[..., Any] | str, str]
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: FuncExceptT) -> None:
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/types/utils.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import sys
3
4
  from contextlib import suppress
4
5
  from functools import wraps
5
6
  from inspect import Signature
@@ -549,6 +550,12 @@ class cachedproperty(property, Generic[R_co]):
549
550
 
550
551
  def deleter(self, fdel: Callable[..., None]) -> cachedproperty[R_co]: ...
551
552
 
553
+ if sys.version_info < (3, 13):
554
+
555
+ def __init__(self, fget: Any, fset: Any | None = None, fdel: Any | None = None, doc: str | None = None) -> None:
556
+ self.__name__ = fget.__name__
557
+ super().__init__(fget, fset, fdel, doc)
558
+
552
559
  @overload
553
560
  def __get__(self, instance: None, owner: type | None = None) -> Self: ...
554
561
 
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
- FuncExceptT,
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: FuncExceptT | None = None
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: FuncExceptT | None = None,
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: FuncExceptT | None = None,
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: FuncExceptT | None = None,
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: FuncExceptT | None = None,
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: FuncExceptT | None = None,
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: FuncExceptT | None = None,
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: FuncExceptT | None = None,
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: FuncExceptT | None = None, **kwargs: Any) -> Any:
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.0
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=3W5CtWRlEtbGoTDF01K0zcMyjXfrii4o8Rdz1tDvRKE,414
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=L5dk6UAsQ3V6GVj0vulKaiJsholnh0Ftyh1FZFM9zwI,2034
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=cCVT-v-mJoWzLvOxB5SG5dkeGAM_allXAuRgjfI9H6E,7649
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=5LYQHdSLM2wu5fv40PTrjkW9v0iq8R-QlQzhVsiLLpE,1509
12
- jetpytools/exceptions/module.py,sha256=hjkpvTPZALRvo1Q5y7D1wEAsssjyRZSZSf98gks3lKw,1231
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=SFnUqDAVehKZ36HmLrs9PN4Ze0BLcabPjwC7hJsGp4w,1102
22
+ jetpytools/types/generic.py,sha256=yCavU0bBXGh15-PxIlQE78xj05kpxMVTAGI7xAoon2Y,1121
23
23
  jetpytools/types/supports.py,sha256=woMTv62HpcRiC5TG18U8NU5v2Q6iqcrHzQgXl7QYEws,3516
24
- jetpytools/types/utils.py,sha256=oISv8o8xD1BS-MjsEDpDBitDQPfkGou1FoyN4EsHYa8,22614
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=um4ow7_UEH1UxOV74w6F1u4s0wC4zh98LrcwBYjed50,10578
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.0.dist-info/METADATA,sha256=iB6mPlOU_lgtyaIwSz1RM-NSe77g-P9r3FepRPCgrI8,1198
31
- jetpytools-1.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
- jetpytools-1.7.0.dist-info/licenses/LICENSE,sha256=l0PN-qDtXcgOB5aXP_nSUsvCK5V3o9pQCGsTzyZhKL0,1071
33
- jetpytools-1.7.0.dist-info/RECORD,,
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,,