Smarter Enumeration Classes
- class smarter.common.enum.SmarterEnumAbstract(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
EnumThe base class of Smarter’s enumerations, whose values are strings.
It adds class methods that list the values, and the url slugs made from them.
str()of a member is its value.from smarter_types import SAMKinds SAMKinds.all() # ["Plugin", "ApiPlugin", ...] str(SAMKinds.SECRET) # "Secret"
- classmethod all_slugs()[source]
Return the url slugs of every value, singular and plural.
- Returns:
singular_slugs(), thenplural_slugs().- Return type:
- classmethod from_url(url)[source]
Return the first slug of a Smarter api url that is one of this enumeration’s slugs.
SAMKinds.from_url("http://localhost:9357/api/v1/cli/example_manifest/Account/") # "account" SAMKinds.from_url("http://localhost:9357/api/v1/cli/whoami/") # None
- classmethod list_all()[source]
Return every member’s value, as one comma-separated string, e.g. for an error message.
- Returns:
The values, separated by
", ".- Return type: