Config Required Fields Module
Provides classes to represent required fields for key/value pairs that must be presenting in the settings.ACTION_TRIGGERS dictionary for a given action.
- class action_triggers.config_required_fields.HasAtLeastOneOffField(field: str = '', *args, **kwargs)[source]
Bases:
RequiredFieldBase
Represents a required field that requires at least one of the fields to be present in the context.
- check(context: dict) bool [source]
Check if at least one of the fields is present in the context.
- Parameters:
context – The context to check.
- Returns:
True if at least one of the fields is present, False otherwise.
- property error_msg: str
The error message to display if at least one of the fields is not present.
- property key_repr: str
The key representation of the field.
- class action_triggers.config_required_fields.HasField(field: str, *args, **kwargs)[source]
Bases:
RequiredFieldBase
Represents a required field that must be present in the context.
- check(context: dict) bool [source]
Check if the field is present in the context.
- Parameters:
context – The context to check.
- Returns:
True if the field is present, False otherwise.
- check_exists(context: dict) bool [source]
Check if the field is present in the context.
- Parameters:
context – The context to check.
- Returns:
True if the field is present, False otherwise.
- check_type_from_args(context: dict) bool [source]
Check if the field type is provided in the first positional argument, and if so, check if the field is of that type.
- Parameters:
context – The context to check.
- Returns:
True if the field is of the specified type, False otherwise.
- Raises:
ValueError – If the first positional argument is not a type.
- check_type_from_kwargs(context: dict) bool [source]
Check if the field type is provided in the type keyword argument, and if so, check if the field is of that type.
- Parameters:
context – The context to check.
- Returns:
True if the field is of the specified type, False otherwise.
- property error_msg: str
The error message to display if the field is not present.
- class action_triggers.config_required_fields.RequiredFieldBase(field: str, *args, **kwargs)[source]
Bases:
ABC
Represents a required field for the connection details and parameters that must be provided by the user.
- abstract check(context: dict) bool [source]
Check if the required field is present in the context.
- Parameters:
context – The context to check.
- Returns:
True if the field is present, False otherwise.
- abstract property error_msg: str
The error message to display if the required field is not present.
- property key_repr: str
The key representation of the field.