The cleanmymac.registry Module

The module holds an internal registry of targets loaded from the cleanmymac.builtins module and from the globally registered ones at cleanmymac.constants.TARGET_ENTRY_POINT.

cleanmymac.registry.get_target(name)[source]

get a registered target

Parameters:name (str) – the target name
Returns:the target
Return type:cleanmymac.target.Target
cleanmymac.registry.get_targets_as_table(simple=True, fancy=False)[source]
cleanmymac.registry.iter_targets()[source]

generator over all registered targets

Returns:pairs of (name: target)
cleanmymac.registry.load_target(yaml_file, config, update=False, verbose=False, strict=True)[source]

load a target given its description from a YAML file. The file is validated according to its type before loading.

Parameters:
  • yaml_file (str) – a valid path to a YAML file
  • config (dict) – the global configuration dictionary
  • update (bool) – specify whether to perform update before cleanup
  • verbose (bool) – toggle verbosity
Returns:

the target

Return type:

cleanmymac.target.Target

cleanmymac.registry.register_target(name, target)[source]

register a target type to a given target name

Parameters:
cleanmymac.registry.register_yaml_targets(path)[source]

scans and registers all valid YAML defined targets in path. The name of the YAML file (without extension) becomes the target name

Parameters:path (str) – a valid directory