A small, dependency-free library that provides additional subclasses of enum.StrEnum
Project description
stringenum
Table Of Contents
About
A small, dependency-free library that provides additional subclasses of enum.StrEnum.
Installation
stringenum
is available on PyPI, so you can simply use pip to install it.
pip install stringenum
Usage
-
stringenum.StrEnum
- Identical toenum.StrEnum
. -
stringenum.CaseInsensitiveStrEnum
- A subclass ofStrEnum
that supports case-insensitive lookup.>>> class Pet(CaseInsensitiveStrEnum): ... CAT = "meow" ... DOG = "bark" >>> Pet("Meow") <Pet.CAT: 'meow'> >>> Pet("BARK") <Pet.DOG: 'bark'> >>> Pet["Cat"] <Pet.CAT: 'meow'> >>> Pet["dog"] <Pet.DOG: 'bark'>
-
stringenum.DoubleSidedStrEnum
- A subclass ofStrEnum
that supports double-sided lookup, allowing both member values and member names to be used for lookups. It also ensures that each member has a unique value.>>> class Status(DoubleSidedStrEnum): ... PENDING = "waiting" ... REJECTED = "denied" >>> Status("PENDING") <Status.PENDING: 'waiting'> >>> Status("waiting") <Status.PENDING: 'waiting'> >>> Status["REJECTED"] <Status.REJECTED: 'denied'> >>> Status["denied"] <Status.REJECTED: 'denied'>
-
stringenum.DoubleSidedCaseInsensitiveStrEnum
- A subclass ofStrEnum
that supports case-insenitive double-sided lookup, allowing both member values and member names to be used for lookups. It also ensures that each member has a unique value.>>> class Status(DoubleSidedCaseInsensitiveStrEnum): ... PENDING = "waiting" ... REJECTED = "denied" >>> Status("pending") <Status.PENDING: 'waiting'> >>> Status("Waiting") <Status.PENDING: 'waiting'> >>> Status["Rejected"] <Status.REJECTED: 'denied'> >>> Status["DenieD"] <Status.REJECTED: 'denied'>
License
Distributed under the MIT License. See LICENSE for more information.
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
Built Distribution
File details
Details for the file stringenum-0.2.0.tar.gz
.
File metadata
- Download URL: stringenum-0.2.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c885aece7115a7558ff8396a93124f6063cfd19ca270df463df9d8ef9c0690d |
|
MD5 | ef34f927fbee278df777cb4a2aa27bb3 |
|
BLAKE2b-256 | 532ce0bfff23b06aff49156168920b74ccd2c79c2cdcfe55ceea17639f1fba5e |
Provenance
The following attestation bundles were made for stringenum-0.2.0.tar.gz
:
Publisher:
release.yml
on Ravencentric/stringenum
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
stringenum-0.2.0.tar.gz
- Subject digest:
7c885aece7115a7558ff8396a93124f6063cfd19ca270df463df9d8ef9c0690d
- Sigstore transparency entry: 150027002
- Sigstore integration time:
- Predicate type:
File details
Details for the file stringenum-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: stringenum-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8048274d95da6add099c0a8df42611076e78379641f1353f3c92539e138425a |
|
MD5 | 0bf26ef7c5e3502502f4fb0eda9db5a6 |
|
BLAKE2b-256 | db3c519f6e75814e23560a188cc6df1f2fb67a7f750593de03ae6e97a8aaa8dd |
Provenance
The following attestation bundles were made for stringenum-0.2.0-py3-none-any.whl
:
Publisher:
release.yml
on Ravencentric/stringenum
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
stringenum-0.2.0-py3-none-any.whl
- Subject digest:
f8048274d95da6add099c0a8df42611076e78379641f1353f3c92539e138425a
- Sigstore transparency entry: 150027003
- Sigstore integration time:
- Predicate type: