Enumy
The problem with Python's "Enum" module is that it is not a reasonable way to restrict variables to a predefined set of values.
Latest version: v1.0.2
Installation
pip install --user enumy
Special methods
check_type
Check if a variable matches a certain data type.
var.check_type(str)
check_value
Check if a value is present in the allowed values.
text = "ByteSentinel"
var.check_value(text)
Example
from enumy import Enumy
test = Enumy(("Value 1", "Value 2"), str)
test = "Value 2" # Working
test = 123 # Exception
Release files for enumy 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| enumy-1.0.2.tar.gz | 1.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| enumy-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.1 kB
Release files / enumy-1.0.2.tar.gz
| Download URL | enumy-1.0.2.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d2ec0bb45af7ad70767d6a851457813e5136d85f54c23b02027106bc4d78d9d
|
|
BLAKE2b-256 checksum How to use checksums |
dd202b53ee142b825518ae75e1e79eb515e5ef4299179f556f7c2a018a5ec09f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / enumy-1.0.2-py3-none-any.whl
| Download URL | enumy-1.0.2-py3-none-any.whl |
|---|---|
| Size | 2.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a0e2b1b4c55673ed3affe5e70be25ba3dc8bfb2ef5ba18b5850e22d25a96c7a
|
|
BLAKE2b-256 checksum How to use checksums |
38a5b6d5e020360094f8c22e7e0d5c212978264f0e73d673b680ef2c90758fa4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|