malcolm.yamlutil

Utilities for making Blocks and Includes from YAML files

malcolm.yamlutil.check_yaml_names(globals_d: Dict[str, Any]) List[str][source]

Check that all include_creators and block_creators have the same name as the base of their file path, and return them in a list suitable for publishing as __all__

malcolm.yamlutil.make_block_creator(yaml_path: str, filename: Optional[str] = None) Callable[[...], List[malcolm.core.controller.Controller]][source]

Make a collection function that will create a list of blocks

Parameters
  • yaml_path (str) – File path to YAML file, or a file in the same dir

  • filename (str) – If give, use this filename as the last element in the yaml_path (so yaml_path can be __file__)

Returns

A collection function decorated with @takes. This can be used in other blocks or instantiated by the process. If the YAML text specified controllers or parts then a block instance with the given name will be instantiated. If there are any blocks listed then they will be called. All created controllers by this or any sub collection will be returned