granola.enums module
- class granola.enums.DocumentedEnum(value)
Bases:
EnumEnum Base class to inherit from that replaces the value option with a description option.
Examples
>>> class HookTypes(DocumentedEnum): ... pre_reading = "Hook to run before `get_reading` methods" ... post_reading = "Hook to run after `get_reading` methods"
>>> HookTypes.pre_reading.name 'pre_reading'
>>> HookTypes.post_reading.description 'Hook to run after `get_reading` methods'
- classmethod str_enum_options()
- class granola.enums.HookTypes(value)
Bases:
DocumentedEnumAllowed hook types for
BaseHookmethods or for aregister_hookCurrent allowed hook types arepre_readingandpost_reading.- post_reading = 'Hook to run after `get_reading` methods'
- pre_reading = 'Hook to run before `get_reading` methods'
- class granola.enums.RandomizeResponse(value)
Bases:
DocumentedEnumThe different ways to specify to randomize or not randomize your
CannedQueriesresponse- not_randomized = "Don't randomize the response"
- randomize_and_remove = 'Randomize and remove'
- randomized_w_replacement = 'Randomize with replacement'
- class granola.enums.SetRelationship(value)
Bases:
DocumentedEnumThe different ways to specify what a hook should do with commands or attributes, should the hook
includeeverything listed in the corresponding data container and nothing else, or should it exclude everything in the corresponding data container and include everything else.- exclude = 'Exclude everything listed in the corresponding data container'
- include = 'Include everything listed in the corresponding data container'
- granola.enums.get_attribute_from_enum(maybe_enum, enum_attribute)
If the passed in maybe_enum is an enum, return the attribute, else return the maybe_enum
- Parameters
maybe_enum (Enum or Enum key) –
enum_attribute (str) – The name of the enum attribute to retrieve
- granola.enums.validate_enum(value, enum)
Validate the given value is in the given enum
- Parameters
value (Enum or enum key) –
enum – the enum to validate against