args
Handles mapping config arguments to a payload with both general and class specific sets
SpockArguments Objects#
class SpockArguments()Class that handles mapping the read parameter dictionary to general or class level arguments
Attributes:
_arguments- dictionary of arguments
__init__#
def __init__(arguments: Dict, config_dag: Graph)Init call for SpockArguments class
Handles creating a clean arguments dictionary that can be cleanly mapped to spock classes
Arguments:
arguments- dictionary of parameters from the config file(s)config_dag- graph of the dependencies between spock classes
__getitem__#
def __getitem__(key: str) -> AnyGets value from the _arguments dictionary
Arguments:
key- dictionary key
Returns:
argument at the specified key
__iter__#
def __iter__() -> Iterable[str]Returns the next value of the keys within the _arguments dictionary
Returns:
current key for the _arguments dictionary
items#
@propertydef items()Returns the k,v tuple iterator for the _arguments dictionary
keys#
@propertydef keys()Returns an iterator for the keys of the _arguments dictionary
values#
@propertydef values()Returns an iterator for the values of the _arguments dictionary
_get_general_arguments#
@staticmethoddef _get_general_arguments(arguments: Dict, config_dag: Graph) -> DictCreates a dictionary of config file parameters that are defined at the general level (not class specific)
Arguments:
arguments- dictionary of parameters from the config file(s)config_dag- graph of the dependencies between spock classes
Returns:
dictionary of general level parameters
_attribute_name_to_config_name_mapping#
def _attribute_name_to_config_name_mapping(config_dag: Graph, general_arguments: Dict) -> DictReturns a mapping of names to spock config class parameter names
Arguments:
config_dag- graph of the dependencies between spock classesgeneral_arguments- dictionary of arguments at the general level
Returns:
dictionary of parameters mapped to spock classes
_is_duplicated_key#
@staticmethoddef _is_duplicated_key(attribute_name_to_config_name_mapping: Dict, attr_name: str, config_name: str) -> boolChecks if a duplicated key exists in multiple classes
Arguments:
attribute_name_to_config_name_mapping- dictionary of class specific name mappings attr_name: config_name:
Returns:
boolean if duplicated
_assign_general_arguments_to_config#
def _assign_general_arguments_to_config(general_arguments: Dict, attribute_name_to_config_name_mapping: Dict) -> NoneAssigns the values from general definitions to values within specific classes if the specific definition doesn't exist
Arguments:
general_arguments: attribute_name_to_config_name_mapping:
Returns:
None
_clean_arguments#
@staticmethoddef _clean_arguments(arguments: Dict, general_arguments: Dict) -> DictSets up a clean dictionary for those not in the general dictionary
Arguments:
arguments- dictionary of all argumentsgeneral_arguments- dictionary of general level arguments
Returns:
clean dictionary of parameters not at the general level