enumerific 1.0.9__py3-none-any.whl → 1.1.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.
- enumerific/extensible.py +17 -5
- enumerific/standard.py +0 -1
- enumerific/version.txt +1 -1
- {enumerific-1.0.9.dist-info → enumerific-1.1.0.dist-info}/METADATA +3 -3
- enumerific-1.1.0.dist-info/RECORD +12 -0
- {enumerific-1.0.9.dist-info → enumerific-1.1.0.dist-info}/WHEEL +1 -1
- enumerific-1.0.9.dist-info/RECORD +0 -12
- {enumerific-1.0.9.dist-info → enumerific-1.1.0.dist-info}/licenses/LICENSE.md +0 -0
- {enumerific-1.0.9.dist-info → enumerific-1.1.0.dist-info}/top_level.txt +0 -0
- {enumerific-1.0.9.dist-info → enumerific-1.1.0.dist-info}/zip-safe +0 -0
enumerific/extensible.py
CHANGED
|
@@ -15,7 +15,6 @@ from enumerific.exceptions import (
|
|
|
15
15
|
|
|
16
16
|
from types import MappingProxyType
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
logger = logger.getChild(__name__)
|
|
20
19
|
|
|
21
20
|
|
|
@@ -750,7 +749,7 @@ class EnumerationMetaClass(type):
|
|
|
750
749
|
typecast=typecast,
|
|
751
750
|
)
|
|
752
751
|
|
|
753
|
-
|
|
752
|
+
name, bases, attributes = args # Unpack the arguments passed to the metaclass
|
|
754
753
|
|
|
755
754
|
logger.debug(" >>> name => %s", name)
|
|
756
755
|
logger.debug(" >>> bases => %s", [base for base in bases])
|
|
@@ -1107,7 +1106,7 @@ class EnumerationMetaClass(type):
|
|
|
1107
1106
|
def __init__(self, *args, **kwargs):
|
|
1108
1107
|
super().__init__(*args, **kwargs)
|
|
1109
1108
|
|
|
1110
|
-
|
|
1109
|
+
name, bases, attributes = args
|
|
1111
1110
|
|
|
1112
1111
|
logger.debug(
|
|
1113
1112
|
"[EnumerationMetaClass] %s.__init__(args: %s, kwargs: %s) => name => %s => bases => %s",
|
|
@@ -1341,12 +1340,25 @@ class EnumerationMetaClass(type):
|
|
|
1341
1340
|
|
|
1342
1341
|
return types.pop() if len(types) == 1 else EnumerationType.MIXED
|
|
1343
1342
|
|
|
1344
|
-
def names(self) -> list[str]:
|
|
1343
|
+
def names(self, uppercase: bool = False, lowercase: bool = False) -> list[str]:
|
|
1345
1344
|
"""The 'names' method returns a list of the enumeration option names."""
|
|
1346
1345
|
|
|
1347
1346
|
logger.debug("%s(%s).names()", self.__class__.__name__, type(self))
|
|
1348
1347
|
|
|
1349
|
-
|
|
1348
|
+
if not isinstance(uppercase, bool):
|
|
1349
|
+
raise TypeError("The 'uppercase' argument must have a boolean value!")
|
|
1350
|
+
|
|
1351
|
+
if not isinstance(lowercase, bool):
|
|
1352
|
+
raise TypeError("The 'lowercase' argument must have a boolean value!")
|
|
1353
|
+
|
|
1354
|
+
names: list[str] = [name for name in self._enumerations]
|
|
1355
|
+
|
|
1356
|
+
if uppercase is True:
|
|
1357
|
+
names = [name.upper() for name in names]
|
|
1358
|
+
elif lowercase is True:
|
|
1359
|
+
names = [name.lower() for name in names]
|
|
1360
|
+
|
|
1361
|
+
return names
|
|
1350
1362
|
|
|
1351
1363
|
def keys(self) -> list[str]:
|
|
1352
1364
|
"""The 'keys' method is an alias of 'names' method; the both return the same."""
|
enumerific/standard.py
CHANGED
enumerific/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0
|
|
1
|
+
1.1.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: enumerific
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Simplifies working with Python enums.
|
|
5
5
|
Author: Daniel Sissman
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,7 +19,7 @@ Requires-Python: >=3.10
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.md
|
|
21
21
|
Provides-Extra: development
|
|
22
|
-
Requires-Dist: black==
|
|
22
|
+
Requires-Dist: black==26.1.*; extra == "development"
|
|
23
23
|
Requires-Dist: pytest==8.3.*; extra == "development"
|
|
24
24
|
Requires-Dist: pytest-codeblocks==0.17.0; extra == "development"
|
|
25
25
|
Provides-Extra: distribution
|
|
@@ -49,7 +49,7 @@ The Enumerific library's `Enumeration` class offers the following features:
|
|
|
49
49
|
* Simple one-line reconciliation of `Enumeration` class options to the corresponding `enums.Enum` class instance that represents the corresponding option; reconciliation by enumeration option name, value and enumeration class instance reference are all supported through the `.reconcile()` class method;
|
|
50
50
|
* Simple one-line validation of `Enumeration` class options; validation by enumeration option name, value and enumeration class instance reference are all supported through the `.validate()` class method;
|
|
51
51
|
* Simple access to all of the options provided by an `Enumeration` class instance through the `.options()` class method;
|
|
52
|
-
* Access to all of the names of the `Enumeration` class options via the `.names()` method;
|
|
52
|
+
* Access to all of the names of the `Enumeration` class options via the `.names()` method, which also takes the optional `uppercase` (`bool`) or `lowercase` (`bool`) keyword arguments which can be used to optionally obtain the names in their uppercase or lowercase forms respectively;
|
|
53
53
|
* Access to all of the names/keys of the `Enumeration` class options via the `.keys()` method;
|
|
54
54
|
* Access to all of the values of the `Enumeration` class options via the `.values()` method;
|
|
55
55
|
* Access to all of the key-value pairs of the `Enumeration` class options via the `.items()` method;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
enumerific/__init__.py,sha256=K9iFirgxSkrHgXfhocOvgRkskGe0VfWRgxEvppnVWBM,587
|
|
2
|
+
enumerific/exceptions.py,sha256=lvfcH1cz43hDjzSUpgm1-OZjKzxo--fyZ8UsBS-GiZA,359
|
|
3
|
+
enumerific/extensible.py,sha256=Jisn5pPLl8UoeC-akg5wasoFOCJjwNXTNAWs-oGD94E,87640
|
|
4
|
+
enumerific/logging.py,sha256=zz1Phnot1BFWMoxwvZ0FlZDsiYZZYhz-_S4IzgPYc40,97
|
|
5
|
+
enumerific/standard.py,sha256=lQqEwXRrQtRYsyfZmCUmNUh7wDvNaP_w_E6okPV_QMA,3253
|
|
6
|
+
enumerific/version.txt,sha256=f70hDr7BH2WpcZDvkAeVxLjaOAWvP1objR0nJVaykso,5
|
|
7
|
+
enumerific-1.1.0.dist-info/licenses/LICENSE.md,sha256=j1XidOCGUhPx7CyXA31uC0XGKDRnvUcZpMp161qHI6g,1077
|
|
8
|
+
enumerific-1.1.0.dist-info/METADATA,sha256=zFgJmPHy1GRbQzC2eaIj5QiLyRVOKvISOdYFKNHe1mo,34430
|
|
9
|
+
enumerific-1.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
10
|
+
enumerific-1.1.0.dist-info/top_level.txt,sha256=hyemsMgPYZgSx71XHmFRF-gvc_2Y4rDAESR8e0hbYHU,11
|
|
11
|
+
enumerific-1.1.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
12
|
+
enumerific-1.1.0.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
enumerific/__init__.py,sha256=K9iFirgxSkrHgXfhocOvgRkskGe0VfWRgxEvppnVWBM,587
|
|
2
|
-
enumerific/exceptions.py,sha256=lvfcH1cz43hDjzSUpgm1-OZjKzxo--fyZ8UsBS-GiZA,359
|
|
3
|
-
enumerific/extensible.py,sha256=JPr4LRGg4rABV_WO9Yzb6FJhrxwiafju7ITIQXW6QiY,87136
|
|
4
|
-
enumerific/logging.py,sha256=zz1Phnot1BFWMoxwvZ0FlZDsiYZZYhz-_S4IzgPYc40,97
|
|
5
|
-
enumerific/standard.py,sha256=xQhhwlcYZ6-8DmgscbV38g2Ol5Z8_vvBwonz-Ww0I40,3254
|
|
6
|
-
enumerific/version.txt,sha256=1vkXxITmpI_Pi5DvCc3gKGw9huXerUi0L68NrpT7LfU,5
|
|
7
|
-
enumerific-1.0.9.dist-info/licenses/LICENSE.md,sha256=j1XidOCGUhPx7CyXA31uC0XGKDRnvUcZpMp161qHI6g,1077
|
|
8
|
-
enumerific-1.0.9.dist-info/METADATA,sha256=LnOD66jWq4fMD79UFTvZA-ILzxh89gdNKs8485h-3b8,34237
|
|
9
|
-
enumerific-1.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
enumerific-1.0.9.dist-info/top_level.txt,sha256=hyemsMgPYZgSx71XHmFRF-gvc_2Y4rDAESR8e0hbYHU,11
|
|
11
|
-
enumerific-1.0.9.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
12
|
-
enumerific-1.0.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|