enumerific 0.0.0__tar.gz → 1.0.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.
- enumerific-1.0.1/PKG-INFO +198 -0
- {enumerific-0.0.0 → enumerific-1.0.1}/README.md +56 -14
- enumerific-1.0.1/pyproject.toml +66 -0
- enumerific-1.0.1/requirements.development.txt +4 -0
- enumerific-1.0.1/requirements.distribution.txt +4 -0
- enumerific-1.0.1/requirements.txt +1 -0
- enumerific-1.0.1/setup.cfg +4 -0
- enumerific-1.0.1/source/enumerific/__init__.py +23 -0
- enumerific-1.0.1/source/enumerific/exceptions.py +18 -0
- enumerific-1.0.1/source/enumerific/extensible.py +1912 -0
- enumerific-1.0.1/source/enumerific/logging.py +5 -0
- enumerific-0.0.0/source/enumerific/__init__.py → enumerific-1.0.1/source/enumerific/standard.py +5 -7
- enumerific-1.0.1/source/enumerific/version.txt +1 -0
- enumerific-1.0.1/source/enumerific.egg-info/PKG-INFO +198 -0
- enumerific-1.0.1/source/enumerific.egg-info/SOURCES.txt +20 -0
- enumerific-1.0.1/source/enumerific.egg-info/requires.txt +10 -0
- enumerific-1.0.1/tests/test_extensible_enums.py +1059 -0
- enumerific-0.0.0/PKG-INFO +0 -4
- enumerific-0.0.0/pyproject.toml +0 -23
- enumerific-0.0.0/setup.cfg +0 -39
- enumerific-0.0.0/setup.py +0 -6
- enumerific-0.0.0/source/enumerific.egg-info/PKG-INFO +0 -4
- enumerific-0.0.0/source/enumerific.egg-info/SOURCES.txt +0 -12
- {enumerific-0.0.0 → enumerific-1.0.1}/LICENSE.md +0 -0
- {enumerific-0.0.0 → enumerific-1.0.1}/source/enumerific.egg-info/dependency_links.txt +0 -0
- {enumerific-0.0.0 → enumerific-1.0.1}/source/enumerific.egg-info/top_level.txt +0 -0
- {enumerific-0.0.0 → enumerific-1.0.1}/source/enumerific.egg-info/zip-safe +0 -0
- {enumerific-0.0.0 → enumerific-1.0.1}/tests/test_enumerific_library.py +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: enumerific
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Simplifies working with Python enums.
|
|
5
|
+
Author: Daniel Sissman
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: documentation, https://github.com/bluebinary/enumerific/blob/main/README.md
|
|
8
|
+
Project-URL: changelog, https://github.com/bluebinary/enumerific/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: repository, https://github.com/bluebinary/enumerific
|
|
10
|
+
Project-URL: issues, https://github.com/bluebinary/enumerific/issues
|
|
11
|
+
Project-URL: homepage, https://github.com/bluebinary/enumerific
|
|
12
|
+
Keywords: enum,enumeration,enumerations
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE.md
|
|
21
|
+
Provides-Extra: development
|
|
22
|
+
Requires-Dist: black==24.10.*; extra == "development"
|
|
23
|
+
Requires-Dist: pytest==8.3.*; extra == "development"
|
|
24
|
+
Requires-Dist: pytest-codeblocks==0.17.0; extra == "development"
|
|
25
|
+
Provides-Extra: distribution
|
|
26
|
+
Requires-Dist: build; extra == "distribution"
|
|
27
|
+
Requires-Dist: twine; extra == "distribution"
|
|
28
|
+
Requires-Dist: wheel; extra == "distribution"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# Enumerific Enums
|
|
32
|
+
|
|
33
|
+
The `enumerific` library provides several useful extensions to the Python built-in `enums` library.
|
|
34
|
+
|
|
35
|
+
### Requirements
|
|
36
|
+
|
|
37
|
+
The Enumerific library has been tested with Python 3.10, 3.11, 3.12 and 3.13, and is not
|
|
38
|
+
compatible with Python 3.9 or earlier.
|
|
39
|
+
|
|
40
|
+
### Installation
|
|
41
|
+
|
|
42
|
+
Enumerific is available from the PyPI, so may be added to a project's dependencies via
|
|
43
|
+
its `requirements.txt` file or similar by referencing the library's name, `enumerific`,
|
|
44
|
+
or the library may be installed directly into your local runtime environment using `pip`
|
|
45
|
+
by entering the following command, and following any prompts:
|
|
46
|
+
|
|
47
|
+
$ pip install enumerific
|
|
48
|
+
|
|
49
|
+
### Usage
|
|
50
|
+
|
|
51
|
+
To use the Enumerific library, simply import the library and use it like you would the built-in `enum` library as a drop-in replacement:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from enumerific import Enum
|
|
55
|
+
|
|
56
|
+
class MyEnum(Enum):
|
|
57
|
+
Option1 = "ABC"
|
|
58
|
+
Option2 = "DEF"
|
|
59
|
+
|
|
60
|
+
val = MyEnum.Option1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Alternatively, to make use of the extra functionality for the standard library's `Enum`
|
|
64
|
+
class, import the `Enum` class from the Enumerific library:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from enumerific import Enum
|
|
68
|
+
|
|
69
|
+
class MyEnum(Enum):
|
|
70
|
+
Option1 = "ABC"
|
|
71
|
+
Option2 = "DEF"
|
|
72
|
+
|
|
73
|
+
val = MyEnum.Option1
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
You can also import the `Enum` class directly from the `enumerific` library and use it directly:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from enumerific import Enum
|
|
80
|
+
|
|
81
|
+
class MyEnum(Enum):
|
|
82
|
+
Option1 = "ABC"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The Enumerific library's own `Enum` class is a subclass of the built-in `enum.Enum` class, so all of the built-in functionality of `enum.Enum` is available, as well as several additional class methods:
|
|
86
|
+
|
|
87
|
+
* `reconcile(value: object, default: Enum = None, raises: bool = False) -> Enum` – The `reconcile` method allows for an enumeration's value or an enumeration option's name to be reconciled against a matching enumeration option. If the provided value can be matched against one of the enumeration's available options, that option will be returned, otherwise there are two possible behaviours: if the `raises` keyword argument has been set to or left as `False` (its default), the value assigned to the `default` keyword argument will be returned, which may be `None` if no default value has been specified; if the `raises` argument has been set to `True` an `EnumValueError` exception will be raised as an alert that the provided value could not be matched. One can also provide an enumeration option as the input value to the `reconcile` method, and these will be validated and returned as-is.
|
|
88
|
+
* `validate(value: object) -> bool` – The `validate` method takes the same range of input values as the `reconcile` method, and returns `True` when the provided value can be reconciled against an enumeration option, or `False` otherwise.
|
|
89
|
+
* `options() -> list[Enum]` – The `options` method provides easy access to the list of the enumeration's available options.
|
|
90
|
+
|
|
91
|
+
The benefits of being able to validate and reconcile various input values against an enumeration, include allowing for a controlled vocabulary of options to be checked against, and the ability to convert enumeration values into their corresponding enumeration option. This can be especially useful when working with input data where you need to convert those values to their corresponding enumeration options, and to be able to do so without maintaining boilerplate code to perform the matching and assignment.
|
|
92
|
+
|
|
93
|
+
Some examples of use include the following code samples, where each make use of the example `MyEnum` class, defined as follows:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from enumerific import Enum
|
|
97
|
+
|
|
98
|
+
class MyEnum(Enum):
|
|
99
|
+
Option1 = "ABC"
|
|
100
|
+
Option2 = "DEF"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Example 1: Reconciling a Value
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from enumerific import Enum
|
|
107
|
+
|
|
108
|
+
class MyEnum(Enum):
|
|
109
|
+
Option1 = "ABC"
|
|
110
|
+
Option2 = "DEF"
|
|
111
|
+
|
|
112
|
+
# Given a string value in this case
|
|
113
|
+
value = "ABC"
|
|
114
|
+
|
|
115
|
+
# Reconcile it to the associated enumeration option
|
|
116
|
+
value = MyEnum.reconcile(value)
|
|
117
|
+
|
|
118
|
+
assert value == MyEnum.Option1 # asserts successfully
|
|
119
|
+
assert value is MyEnum.Option1 # asserts successfully as enums are singletons
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Example 2: Reconciling an Enumeration Option Name
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from enumerific import Enum
|
|
126
|
+
|
|
127
|
+
class MyEnum(Enum):
|
|
128
|
+
Option1 = "ABC"
|
|
129
|
+
Option2 = "DEF"
|
|
130
|
+
|
|
131
|
+
# Given a string value in this case
|
|
132
|
+
value = "Option1"
|
|
133
|
+
|
|
134
|
+
# Reconcile it to the associated enumeration option
|
|
135
|
+
value = MyEnum.reconcile(value)
|
|
136
|
+
|
|
137
|
+
assert value == MyEnum.Option1 # asserts successfully
|
|
138
|
+
assert value is MyEnum.Option1 # asserts successfully as enums are singletons
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Example 3: Validating a Value
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from enumerific import Enum
|
|
145
|
+
|
|
146
|
+
class MyEnum(Enum):
|
|
147
|
+
Option1 = "ABC"
|
|
148
|
+
Option2 = "DEF"
|
|
149
|
+
|
|
150
|
+
# The value can be an enumeration option's name, its value, or the enumeration option
|
|
151
|
+
value = "Option1"
|
|
152
|
+
value = "ABC"
|
|
153
|
+
value = MyEnum.Option1
|
|
154
|
+
|
|
155
|
+
if MyEnum.validate(value) is True:
|
|
156
|
+
# do something if the value could be validated
|
|
157
|
+
pass
|
|
158
|
+
else:
|
|
159
|
+
# do something else if the value could not be validated
|
|
160
|
+
pass
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Example 4: Iterating Over Enumeration Options
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from enumerific import Enum
|
|
167
|
+
|
|
168
|
+
class MyEnum(Enum):
|
|
169
|
+
Option1 = "ABC"
|
|
170
|
+
Option2 = "DEF"
|
|
171
|
+
|
|
172
|
+
for option in MyEnum.options():
|
|
173
|
+
# do something with each option
|
|
174
|
+
print(option.name, option.value)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Unit Tests
|
|
178
|
+
|
|
179
|
+
The Enumerific library includes a suite of comprehensive unit tests which ensure that the library functionality operates as expected. The unit tests were developed with and are run via `pytest`.
|
|
180
|
+
|
|
181
|
+
To ensure that the unit tests are run within a predictable runtime environment where all of the necessary dependencies are available, a [Docker](https://www.docker.com) image is created within which the tests are run. To run the unit tests, ensure Docker and Docker Compose is [installed](https://docs.docker.com/engine/install/), and perform the following commands, which will build the Docker image via `docker compose build` and then run the tests via `docker compose run` – the output of running the tests will be displayed:
|
|
182
|
+
|
|
183
|
+
```shell
|
|
184
|
+
$ docker compose build
|
|
185
|
+
$ docker compose run tests
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
To run the unit tests with optional command line arguments being passed to `pytest`, append the relevant arguments to the `docker compose run tests` command, as follows, for example passing `-vv` to enable verbose output:
|
|
189
|
+
|
|
190
|
+
```shell
|
|
191
|
+
$ docker compose run tests -vv
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
See the documentation for [PyTest](https://docs.pytest.org/en/latest/) regarding available optional command line arguments.
|
|
195
|
+
|
|
196
|
+
### Copyright & License Information
|
|
197
|
+
|
|
198
|
+
Copyright © 2024–2025 Daniel Sissman; licensed under the MIT License.
|
|
@@ -4,11 +4,15 @@ The `enumerific` library provides several useful extensions to the Python built-
|
|
|
4
4
|
|
|
5
5
|
### Requirements
|
|
6
6
|
|
|
7
|
-
The Enumerific library has been tested with Python 3.
|
|
7
|
+
The Enumerific library has been tested with Python 3.10, 3.11, 3.12 and 3.13, and is not
|
|
8
|
+
compatible with Python 3.9 or earlier.
|
|
8
9
|
|
|
9
10
|
### Installation
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
Enumerific is available from the PyPI, so may be added to a project's dependencies via
|
|
13
|
+
its `requirements.txt` file or similar by referencing the library's name, `enumerific`,
|
|
14
|
+
or the library may be installed directly into your local runtime environment using `pip`
|
|
15
|
+
by entering the following command, and following any prompts:
|
|
12
16
|
|
|
13
17
|
$ pip install enumerific
|
|
14
18
|
|
|
@@ -16,10 +20,23 @@ The Enumerific library is available from PyPi, so may be added to a project's de
|
|
|
16
20
|
|
|
17
21
|
To use the Enumerific library, simply import the library and use it like you would the built-in `enum` library as a drop-in replacement:
|
|
18
22
|
|
|
23
|
+
```python
|
|
24
|
+
from enumerific import Enum
|
|
25
|
+
|
|
26
|
+
class MyEnum(Enum):
|
|
27
|
+
Option1 = "ABC"
|
|
28
|
+
Option2 = "DEF"
|
|
29
|
+
|
|
30
|
+
val = MyEnum.Option1
|
|
19
31
|
```
|
|
20
|
-
import enumerific
|
|
21
32
|
|
|
22
|
-
|
|
33
|
+
Alternatively, to make use of the extra functionality for the standard library's `Enum`
|
|
34
|
+
class, import the `Enum` class from the Enumerific library:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from enumerific import Enum
|
|
38
|
+
|
|
39
|
+
class MyEnum(Enum):
|
|
23
40
|
Option1 = "ABC"
|
|
24
41
|
Option2 = "DEF"
|
|
25
42
|
|
|
@@ -28,12 +45,11 @@ val = MyEnum.Option1
|
|
|
28
45
|
|
|
29
46
|
You can also import the `Enum` class directly from the `enumerific` library and use it directly:
|
|
30
47
|
|
|
31
|
-
```
|
|
48
|
+
```python
|
|
32
49
|
from enumerific import Enum
|
|
33
50
|
|
|
34
51
|
class MyEnum(Enum):
|
|
35
52
|
Option1 = "ABC"
|
|
36
|
-
...
|
|
37
53
|
```
|
|
38
54
|
|
|
39
55
|
The Enumerific library's own `Enum` class is a subclass of the built-in `enum.Enum` class, so all of the built-in functionality of `enum.Enum` is available, as well as several additional class methods:
|
|
@@ -46,7 +62,7 @@ The benefits of being able to validate and reconcile various input values agains
|
|
|
46
62
|
|
|
47
63
|
Some examples of use include the following code samples, where each make use of the example `MyEnum` class, defined as follows:
|
|
48
64
|
|
|
49
|
-
```
|
|
65
|
+
```python
|
|
50
66
|
from enumerific import Enum
|
|
51
67
|
|
|
52
68
|
class MyEnum(Enum):
|
|
@@ -56,7 +72,13 @@ class MyEnum(Enum):
|
|
|
56
72
|
|
|
57
73
|
#### Example 1: Reconciling a Value
|
|
58
74
|
|
|
59
|
-
```
|
|
75
|
+
```python
|
|
76
|
+
from enumerific import Enum
|
|
77
|
+
|
|
78
|
+
class MyEnum(Enum):
|
|
79
|
+
Option1 = "ABC"
|
|
80
|
+
Option2 = "DEF"
|
|
81
|
+
|
|
60
82
|
# Given a string value in this case
|
|
61
83
|
value = "ABC"
|
|
62
84
|
|
|
@@ -69,7 +91,13 @@ assert value is MyEnum.Option1 # asserts successfully as enums are singletons
|
|
|
69
91
|
|
|
70
92
|
#### Example 2: Reconciling an Enumeration Option Name
|
|
71
93
|
|
|
72
|
-
```
|
|
94
|
+
```python
|
|
95
|
+
from enumerific import Enum
|
|
96
|
+
|
|
97
|
+
class MyEnum(Enum):
|
|
98
|
+
Option1 = "ABC"
|
|
99
|
+
Option2 = "DEF"
|
|
100
|
+
|
|
73
101
|
# Given a string value in this case
|
|
74
102
|
value = "Option1"
|
|
75
103
|
|
|
@@ -82,7 +110,13 @@ assert value is MyEnum.Option1 # asserts successfully as enums are singletons
|
|
|
82
110
|
|
|
83
111
|
#### Example 3: Validating a Value
|
|
84
112
|
|
|
85
|
-
```
|
|
113
|
+
```python
|
|
114
|
+
from enumerific import Enum
|
|
115
|
+
|
|
116
|
+
class MyEnum(Enum):
|
|
117
|
+
Option1 = "ABC"
|
|
118
|
+
Option2 = "DEF"
|
|
119
|
+
|
|
86
120
|
# The value can be an enumeration option's name, its value, or the enumeration option
|
|
87
121
|
value = "Option1"
|
|
88
122
|
value = "ABC"
|
|
@@ -90,13 +124,21 @@ value = MyEnum.Option1
|
|
|
90
124
|
|
|
91
125
|
if MyEnum.validate(value) is True:
|
|
92
126
|
# do something if the value could be validated
|
|
127
|
+
pass
|
|
93
128
|
else:
|
|
94
129
|
# do something else if the value could not be validated
|
|
130
|
+
pass
|
|
95
131
|
```
|
|
96
132
|
|
|
97
133
|
#### Example 4: Iterating Over Enumeration Options
|
|
98
134
|
|
|
99
|
-
```
|
|
135
|
+
```python
|
|
136
|
+
from enumerific import Enum
|
|
137
|
+
|
|
138
|
+
class MyEnum(Enum):
|
|
139
|
+
Option1 = "ABC"
|
|
140
|
+
Option2 = "DEF"
|
|
141
|
+
|
|
100
142
|
for option in MyEnum.options():
|
|
101
143
|
# do something with each option
|
|
102
144
|
print(option.name, option.value)
|
|
@@ -108,14 +150,14 @@ The Enumerific library includes a suite of comprehensive unit tests which ensure
|
|
|
108
150
|
|
|
109
151
|
To ensure that the unit tests are run within a predictable runtime environment where all of the necessary dependencies are available, a [Docker](https://www.docker.com) image is created within which the tests are run. To run the unit tests, ensure Docker and Docker Compose is [installed](https://docs.docker.com/engine/install/), and perform the following commands, which will build the Docker image via `docker compose build` and then run the tests via `docker compose run` – the output of running the tests will be displayed:
|
|
110
152
|
|
|
111
|
-
```
|
|
153
|
+
```shell
|
|
112
154
|
$ docker compose build
|
|
113
155
|
$ docker compose run tests
|
|
114
156
|
```
|
|
115
157
|
|
|
116
158
|
To run the unit tests with optional command line arguments being passed to `pytest`, append the relevant arguments to the `docker compose run tests` command, as follows, for example passing `-vv` to enable verbose output:
|
|
117
159
|
|
|
118
|
-
```
|
|
160
|
+
```shell
|
|
119
161
|
$ docker compose run tests -vv
|
|
120
162
|
```
|
|
121
163
|
|
|
@@ -123,4 +165,4 @@ See the documentation for [PyTest](https://docs.pytest.org/en/latest/) regarding
|
|
|
123
165
|
|
|
124
166
|
### Copyright & License Information
|
|
125
167
|
|
|
126
|
-
Copyright © 2024–2025 Daniel Sissman;
|
|
168
|
+
Copyright © 2024–2025 Daniel Sissman; licensed under the MIT License.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "enumerific"
|
|
3
|
+
description = "Simplifies working with Python enums."
|
|
4
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
5
|
+
keywords = ["enum", "enumeration", "enumerations"]
|
|
6
|
+
authors = [{name = "Daniel Sissman"}]
|
|
7
|
+
license = "MIT"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Programming Language :: Python :: 3",
|
|
10
|
+
"Programming Language :: Python :: 3.10",
|
|
11
|
+
"Programming Language :: Python :: 3.11",
|
|
12
|
+
"Programming Language :: Python :: 3.12",
|
|
13
|
+
"Programming Language :: Python :: 3.13",
|
|
14
|
+
]
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
dynamic = [
|
|
17
|
+
"version",
|
|
18
|
+
"dependencies",
|
|
19
|
+
"optional-dependencies",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
documentation = "https://github.com/bluebinary/enumerific/blob/main/README.md"
|
|
24
|
+
changelog = "https://github.com/bluebinary/enumerific/blob/main/CHANGELOG.md"
|
|
25
|
+
repository = "https://github.com/bluebinary/enumerific"
|
|
26
|
+
issues = "https://github.com/bluebinary/enumerific/issues"
|
|
27
|
+
homepage = "https://github.com/bluebinary/enumerific"
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["setuptools", "wheel"]
|
|
31
|
+
build-backend = "setuptools.build_meta"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.dynamic]
|
|
34
|
+
version = {file = "source/enumerific/version.txt"}
|
|
35
|
+
dependencies = {file = "requirements.txt"}
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.dynamic.optional-dependencies]
|
|
38
|
+
development = {file = "requirements.development.txt"}
|
|
39
|
+
distribution = {file = "requirements.distribution.txt"}
|
|
40
|
+
|
|
41
|
+
[tool.setuptools]
|
|
42
|
+
zip-safe = true
|
|
43
|
+
include-package-data = true
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages]
|
|
46
|
+
find = {where = ["source"]}
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
minversion = "6.0"
|
|
50
|
+
addopts = "-ra -q"
|
|
51
|
+
testpaths = [
|
|
52
|
+
"tests"
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.black]
|
|
56
|
+
line-length = 88
|
|
57
|
+
target-version = ['py310']
|
|
58
|
+
include = '\.pyi?$'
|
|
59
|
+
extend-exclude = '''
|
|
60
|
+
/(
|
|
61
|
+
# The following are specific to Black, you probably don't want those.
|
|
62
|
+
| blib2to3
|
|
63
|
+
| tests/data
|
|
64
|
+
| profiling
|
|
65
|
+
)/
|
|
66
|
+
'''
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Enumerific Library: Runtime Dependencies
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from enum import *
|
|
2
|
+
|
|
3
|
+
from .logging import logger
|
|
4
|
+
|
|
5
|
+
from .exceptions import EnumValueError
|
|
6
|
+
|
|
7
|
+
from .extensible import (
|
|
8
|
+
Enumeration,
|
|
9
|
+
EnumerationType,
|
|
10
|
+
EnumerationInteger,
|
|
11
|
+
EnumerationString,
|
|
12
|
+
EnumerationFloat,
|
|
13
|
+
EnumerationComplex,
|
|
14
|
+
EnumerationBytes,
|
|
15
|
+
EnumerationTuple,
|
|
16
|
+
EnumerationSet,
|
|
17
|
+
EnumerationList,
|
|
18
|
+
EnumerationDictionary,
|
|
19
|
+
EnumerationFlag,
|
|
20
|
+
auto,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
from .standard import Enum
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class EnumValueError(ValueError):
|
|
2
|
+
pass
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class EnumerationError(RuntimeError):
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class EnumerationOptionError(AttributeError, EnumerationError):
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class EnumerationSubclassingError(EnumerationError):
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class EnumerationNonUniqueError(EnumerationError):
|
|
18
|
+
pass
|