Skip to main content

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)

Source distribution for enumy 1.0.2
File Size Uploaded
enumy-1.0.2.tar.gz 1.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for enumy 1.0.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page