jetpytools 2.1.0__tar.gz → 2.1.1__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.

Potentially problematic release.


This version of jetpytools might be problematic. Click here for more details.

Files changed (34) hide show
  1. {jetpytools-2.1.0 → jetpytools-2.1.1}/PKG-INFO +1 -1
  2. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/_metadata.py +1 -1
  3. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/enums/base.py +36 -8
  4. {jetpytools-2.1.0 → jetpytools-2.1.1}/.gitignore +0 -0
  5. {jetpytools-2.1.0 → jetpytools-2.1.1}/LICENSE +0 -0
  6. {jetpytools-2.1.0 → jetpytools-2.1.1}/README.md +0 -0
  7. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/__init__.py +0 -0
  8. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/enums/__init__.py +0 -0
  9. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/enums/other.py +0 -0
  10. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/exceptions/__init__.py +0 -0
  11. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/exceptions/base.py +0 -0
  12. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/exceptions/enum.py +0 -0
  13. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/exceptions/file.py +0 -0
  14. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/exceptions/generic.py +0 -0
  15. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/exceptions/module.py +0 -0
  16. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/functions/__init__.py +0 -0
  17. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/functions/funcs.py +0 -0
  18. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/functions/normalize.py +0 -0
  19. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/functions/other.py +0 -0
  20. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/py.typed +0 -0
  21. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/__init__.py +0 -0
  22. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/builtins.py +0 -0
  23. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/check.py +0 -0
  24. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/file.py +0 -0
  25. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/funcs.py +0 -0
  26. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/generic.py +0 -0
  27. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/supports.py +0 -0
  28. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/types/utils.py +0 -0
  29. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/utils/__init__.py +0 -0
  30. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/utils/file.py +0 -0
  31. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/utils/funcs.py +0 -0
  32. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/utils/math.py +0 -0
  33. {jetpytools-2.1.0 → jetpytools-2.1.1}/jetpytools/utils/ranges.py +0 -0
  34. {jetpytools-2.1.0 → jetpytools-2.1.1}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jetpytools
3
- Version: 2.1.0
3
+ Version: 2.1.1
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,6 +1,6 @@
1
1
  """Collection of stuff that's useful in general python programming"""
2
2
 
3
- __version__ = "2.1.0"
3
+ __version__ = "2.1.1"
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__
@@ -1,11 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from abc import ABCMeta
4
- from enum import Enum, EnumMeta
5
- from typing import Any, Self
4
+ from enum import Enum, EnumMeta, ReprEnum
5
+ from enum import property as enum_property
6
+ from typing import TYPE_CHECKING, Any, Self
6
7
 
7
- from ..exceptions import NotFoundEnumValueError
8
- from ..types import FuncExcept
8
+ from ..exceptions import CustomTypeError, NotFoundEnumValueError
9
+ from ..types import FuncExcept, copy_signature
9
10
 
10
11
  __all__ = ["CustomEnum", "CustomIntEnum", "CustomStrEnum", "EnumABCMeta"]
11
12
 
@@ -13,6 +14,25 @@ __all__ = ["CustomEnum", "CustomIntEnum", "CustomStrEnum", "EnumABCMeta"]
13
14
  class EnumABCMeta(EnumMeta, ABCMeta):
14
15
  """Metaclass combining EnumMeta and ABCMeta to support abstract enumerations."""
15
16
 
17
+ @copy_signature(EnumMeta.__new__)
18
+ def __new__(mcls, *args: Any, **kwargs: Any) -> Any:
19
+ enum_cls = super().__new__(mcls, *args, **kwargs)
20
+
21
+ if len(enum_cls) == 0:
22
+ return enum_cls
23
+
24
+ if enum_cls.__abstractmethods__:
25
+ raise CustomTypeError(
26
+ "Can't instantiate abstract class {cls_name} without an implementation "
27
+ "for abstract method{plural} {methods}.",
28
+ enum_cls,
29
+ cls_name=enum_cls.__name__,
30
+ plural="s" if len(enum_cls.__abstractmethods__) > 1 else "",
31
+ methods=", ".join(f"'{n}'" for n in sorted(enum_cls.__abstractmethods__)),
32
+ )
33
+
34
+ return enum_cls
35
+
16
36
 
17
37
  class CustomEnum(Enum):
18
38
  """Base class for custom enums."""
@@ -53,13 +73,21 @@ class CustomEnum(Enum):
53
73
  ) from None
54
74
 
55
75
 
56
- class CustomIntEnum(int, CustomEnum):
76
+ class CustomIntEnum(int, CustomEnum, ReprEnum):
57
77
  """Base class for custom int enums."""
58
78
 
59
- _value_: int
79
+ if TYPE_CHECKING:
80
+ _value_: int
81
+
82
+ @enum_property
83
+ def value(self) -> int: ...
60
84
 
61
85
 
62
- class CustomStrEnum(str, CustomEnum):
86
+ class CustomStrEnum(str, CustomEnum, ReprEnum):
63
87
  """Base class for custom str enums."""
64
88
 
65
- _value_: str
89
+ if TYPE_CHECKING:
90
+ _value_: str
91
+
92
+ @enum_property
93
+ def value(self) -> str: ...
File without changes
File without changes
File without changes
File without changes