caoscrawler.macros.macro_yaml_object module#
- class caoscrawler.macros.macro_yaml_object.MacroDefinition(name: str, params: Dict[str, Any], definition: Any)#
Bases:
objectStores a macro definition. name: Name of the macro params: variables and default values to be substituted in keys or values definition: A dictionary that will be substituted including parameters
- definition: Any#
- name: str#
- params: Dict[str, Any]#
- caoscrawler.macros.macro_yaml_object.defmacro_constructor(loader, node)#
Function for registering macros in yaml files.
It can be registered in pyaml using: yaml.SafeLoader.add_constructor(“!defmacro”, defmacro_constructor)
- caoscrawler.macros.macro_yaml_object.macro_constructor(loader, node)#
Function for substituting macros in yaml files.
It can be registered in pyaml using: yaml.SafeLoader.add_constructor(“!macro”, macro_constructor)
- caoscrawler.macros.macro_yaml_object.substitute(propvalue, values: dict)#
Substitution of variables in strings using the variable substitution library from python’s standard library.
- caoscrawler.macros.macro_yaml_object.substitute_dict(sourced: Dict[str, Any], values: Dict[str, Any])#
Create a copy of sourced. Afterwards recursively do variable substitution on all keys and values.