Module to set predefined allowed values for a variable
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
enumy-1.0.2.tar.gz
(1.9 kB
view hashes)
Built Distribution
enumy-1.0.2-py3-none-any.whl
(2.1 kB
view hashes)