enumerific 1.0.9__tar.gz → 1.1.0__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.
- {enumerific-1.0.9/source/enumerific.egg-info → enumerific-1.1.0}/PKG-INFO +3 -3
- {enumerific-1.0.9 → enumerific-1.1.0}/README.md +1 -1
- {enumerific-1.0.9 → enumerific-1.1.0}/requirements.development.txt +1 -1
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific/extensible.py +17 -5
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific/standard.py +0 -1
- enumerific-1.1.0/source/enumerific/version.txt +1 -0
- {enumerific-1.0.9 → enumerific-1.1.0/source/enumerific.egg-info}/PKG-INFO +3 -3
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific.egg-info/requires.txt +1 -1
- {enumerific-1.0.9 → enumerific-1.1.0}/tests/test_extensible_enums.py +3 -4
- enumerific-1.0.9/source/enumerific/version.txt +0 -1
- {enumerific-1.0.9 → enumerific-1.1.0}/LICENSE.md +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/pyproject.toml +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/requirements.distribution.txt +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/requirements.txt +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/setup.cfg +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific/__init__.py +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific/exceptions.py +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific/logging.py +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific.egg-info/SOURCES.txt +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific.egg-info/dependency_links.txt +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific.egg-info/top_level.txt +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/source/enumerific.egg-info/zip-safe +0 -0
- {enumerific-1.0.9 → enumerific-1.1.0}/tests/test_enumerific_library.py +0 -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;
|
|
@@ -19,7 +19,7 @@ The Enumerific library's `Enumeration` class offers the following features:
|
|
|
19
19
|
* 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;
|
|
20
20
|
* 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;
|
|
21
21
|
* Simple access to all of the options provided by an `Enumeration` class instance through the `.options()` class method;
|
|
22
|
-
* Access to all of the names of the `Enumeration` class options via the `.names()` method;
|
|
22
|
+
* 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;
|
|
23
23
|
* Access to all of the names/keys of the `Enumeration` class options via the `.keys()` method;
|
|
24
24
|
* Access to all of the values of the `Enumeration` class options via the `.values()` method;
|
|
25
25
|
* Access to all of the key-value pairs of the `Enumeration` class options via the `.items()` method;
|
|
@@ -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."""
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -24,7 +24,6 @@ from enumerific import (
|
|
|
24
24
|
anno,
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
logger = logging.getLogger(__name__)
|
|
29
28
|
|
|
30
29
|
|
|
@@ -1631,7 +1630,7 @@ def test_annotation_access():
|
|
|
1631
1630
|
"""Convert the RGB color code into its HLS equivalent."""
|
|
1632
1631
|
|
|
1633
1632
|
# Normalize the RGB values into a 0-255 range first
|
|
1634
|
-
|
|
1633
|
+
h, l, s = colorsys.rgb_to_hls(
|
|
1635
1634
|
self.RGB[0] / 255.0,
|
|
1636
1635
|
self.RGB[1] / 255.0,
|
|
1637
1636
|
self.RGB[2] / 255.0,
|
|
@@ -1643,7 +1642,7 @@ def test_annotation_access():
|
|
|
1643
1642
|
def isWarm(self):
|
|
1644
1643
|
"""Roughly (just for test purposes) determine in the color is 'warm'"""
|
|
1645
1644
|
|
|
1646
|
-
|
|
1645
|
+
hue, lightness, saturation = self.HLS
|
|
1647
1646
|
|
|
1648
1647
|
return (
|
|
1649
1648
|
(0 <= hue < 115) and (0 < lightness <= 80) and (10 <= saturation <= 100)
|
|
@@ -1652,7 +1651,7 @@ def test_annotation_access():
|
|
|
1652
1651
|
def isCool(self):
|
|
1653
1652
|
"""Roughly (just for test purposes) determine in the color is 'cool'"""
|
|
1654
1653
|
|
|
1655
|
-
|
|
1654
|
+
hue, lightness, saturation = self.HLS
|
|
1656
1655
|
|
|
1657
1656
|
return (
|
|
1658
1657
|
(115 <= hue <= 360) and (lightness <= 100) and (saturation <= 100)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.0.9
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|