enumerific 1.0.8__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.8/source/enumerific.egg-info → enumerific-1.1.0}/PKG-INFO +4 -4
- {enumerific-1.0.8 → enumerific-1.1.0}/README.md +2 -2
- {enumerific-1.0.8 → enumerific-1.1.0}/requirements.development.txt +1 -1
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific/extensible.py +19 -6
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific/standard.py +0 -1
- enumerific-1.1.0/source/enumerific/version.txt +1 -0
- {enumerific-1.0.8 → enumerific-1.1.0/source/enumerific.egg-info}/PKG-INFO +4 -4
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific.egg-info/requires.txt +1 -1
- {enumerific-1.0.8 → enumerific-1.1.0}/tests/test_extensible_enums.py +3 -4
- enumerific-1.0.8/source/enumerific/version.txt +0 -1
- {enumerific-1.0.8 → enumerific-1.1.0}/LICENSE.md +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/pyproject.toml +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/requirements.distribution.txt +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/requirements.txt +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/setup.cfg +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific/__init__.py +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific/exceptions.py +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific/logging.py +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific.egg-info/SOURCES.txt +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific.egg-info/dependency_links.txt +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific.egg-info/top_level.txt +0 -0
- {enumerific-1.0.8 → enumerific-1.1.0}/source/enumerific.egg-info/zip-safe +0 -0
- {enumerific-1.0.8 → 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;
|
|
@@ -900,4 +900,4 @@ See the documentation for [PyTest](https://docs.pytest.org/en/latest/) regarding
|
|
|
900
900
|
|
|
901
901
|
### Copyright & License Information
|
|
902
902
|
|
|
903
|
-
Copyright © 2024–
|
|
903
|
+
Copyright © 2024–2026 Daniel Sissman; licensed under the MIT License.
|
|
@@ -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;
|
|
@@ -870,4 +870,4 @@ See the documentation for [PyTest](https://docs.pytest.org/en/latest/) regarding
|
|
|
870
870
|
|
|
871
871
|
### Copyright & License Information
|
|
872
872
|
|
|
873
|
-
Copyright © 2024–
|
|
873
|
+
Copyright © 2024–2026 Daniel Sissman; licensed under the MIT License.
|
|
@@ -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
|
|
|
@@ -90,6 +89,7 @@ class auto(int, anno):
|
|
|
90
89
|
|
|
91
90
|
start: int = 0
|
|
92
91
|
steps: int = 1
|
|
92
|
+
times: int = 0
|
|
93
93
|
power: int = 0
|
|
94
94
|
value: int = 0
|
|
95
95
|
|
|
@@ -749,7 +749,7 @@ class EnumerationMetaClass(type):
|
|
|
749
749
|
typecast=typecast,
|
|
750
750
|
)
|
|
751
751
|
|
|
752
|
-
|
|
752
|
+
name, bases, attributes = args # Unpack the arguments passed to the metaclass
|
|
753
753
|
|
|
754
754
|
logger.debug(" >>> name => %s", name)
|
|
755
755
|
logger.debug(" >>> bases => %s", [base for base in bases])
|
|
@@ -1106,7 +1106,7 @@ class EnumerationMetaClass(type):
|
|
|
1106
1106
|
def __init__(self, *args, **kwargs):
|
|
1107
1107
|
super().__init__(*args, **kwargs)
|
|
1108
1108
|
|
|
1109
|
-
|
|
1109
|
+
name, bases, attributes = args
|
|
1110
1110
|
|
|
1111
1111
|
logger.debug(
|
|
1112
1112
|
"[EnumerationMetaClass] %s.__init__(args: %s, kwargs: %s) => name => %s => bases => %s",
|
|
@@ -1340,12 +1340,25 @@ class EnumerationMetaClass(type):
|
|
|
1340
1340
|
|
|
1341
1341
|
return types.pop() if len(types) == 1 else EnumerationType.MIXED
|
|
1342
1342
|
|
|
1343
|
-
def names(self) -> list[str]:
|
|
1343
|
+
def names(self, uppercase: bool = False, lowercase: bool = False) -> list[str]:
|
|
1344
1344
|
"""The 'names' method returns a list of the enumeration option names."""
|
|
1345
1345
|
|
|
1346
1346
|
logger.debug("%s(%s).names()", self.__class__.__name__, type(self))
|
|
1347
1347
|
|
|
1348
|
-
|
|
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
|
|
1349
1362
|
|
|
1350
1363
|
def keys(self) -> list[str]:
|
|
1351
1364
|
"""The 'keys' method is an alias of 'names' method; the both return the same."""
|
|
@@ -1378,7 +1391,7 @@ class EnumerationMetaClass(type):
|
|
|
1378
1391
|
|
|
1379
1392
|
return self._instance.__name__
|
|
1380
1393
|
|
|
1381
|
-
def register(self, name: str, value: object) -> Enumeration:
|
|
1394
|
+
def register(self, name: str, value: object = auto()) -> Enumeration:
|
|
1382
1395
|
"""The 'register' method supports registering additional enumeration options for
|
|
1383
1396
|
an existing enumeration class. The method accepts the name of the enumeration
|
|
1384
1397
|
option and its corresponding value; these are then mapped into a new enumeration
|
|
@@ -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;
|
|
@@ -900,4 +900,4 @@ See the documentation for [PyTest](https://docs.pytest.org/en/latest/) regarding
|
|
|
900
900
|
|
|
901
901
|
### Copyright & License Information
|
|
902
902
|
|
|
903
|
-
Copyright © 2024–
|
|
903
|
+
Copyright © 2024–2026 Daniel Sissman; licensed under the MIT License.
|
|
@@ -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.8
|
|
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
|