an enum `AutoName` from python docs with multiple stringcase options
Project description
This project is archived. I find StrEnum, fastapi-utils is better.
I removed autoname from pypi
autoname
an enum AutoName
from python docs with multiple stringcase options.
Get Started
$ pip install autoname
from autoname import Autoname
from enum import auto
# an enum class
class GameType(AutoName):
INDIE = auto()
print(GameType.INDIE.value) # "INDIE"
# could be alternative in pydantic instead of literal
from pydantic import BaseModel
class Game(BaseModel):
type: GameType
Also have others stringcases coverter
AutoNameLower
- convert name value to lowercaseAutoNameUpper
- convert name value to uppercase
e.g.
class GameType(AutoNameLower):
INDIE = auto()
print(GameType.INDIE.value) # "indie"
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
autoname-1.0.0.tar.gz
(2.8 kB
view hashes)