onyo.lib.pseudokeys module

onyo.lib.pseudokeys.PSEUDOKEY_ALIASES: Dict[str, str] = {'directory': 'onyo.path.parent', 'path': 'onyo.path.relative'}

Aliases that map a key name to another.

onyo.lib.pseudokeys.PSEUDO_KEYS: Dict[str, PseudoKey] = {'onyo.is.asset': PseudoKey(description='Is the item an asset.', implementation=functools.partial(<function delegate>, attribute='_is_asset')), 'onyo.is.directory': PseudoKey(description='Is the item a directory.', implementation=functools.partial(<function delegate>, attribute='_is_directory')), 'onyo.is.empty': PseudoKey(description='Is the directory empty. <unset> if the item is not a directory.', implementation=functools.partial(<function delegate>, attribute='_is_empty')), 'onyo.is.template': PseudoKey(description='Is the item a template.', implementation=functools.partial(<function delegate>, attribute='_is_template')), 'onyo.path.absolute': PseudoKey(description='Absolute path of the item.', implementation=functools.partial(<function delegate>, attribute='_get_path_absolute')), 'onyo.path.file': PseudoKey(description="Path to the file containing an asset's YAML.Different from 'onyo.path.relative' in case of an asset directory.", implementation=functools.partial(<function delegate>, attribute='_get_path_file')), 'onyo.path.name': PseudoKey(description="Basename of the item's path.", implementation=functools.partial(<function delegate>, attribute='_get_path_name')), 'onyo.path.parent': PseudoKey(description='Path of the directory the item is in, relative to the repository root.', implementation=functools.partial(<function delegate>, attribute='_get_path_parent')), 'onyo.path.relative': PseudoKey(description='Path of the item relative to the repository root.', implementation=functools.partial(<function delegate>, attribute='_get_path_relative')), 'onyo.was.created.author.email': PseudoKey(description='Email of the author of the commit that created the item.', implementation=functools.partial(<function delegate>, attribute='_fill_created', key='author.email')), 'onyo.was.created.author.name': PseudoKey(description='Name of the author of the commit that created the item.', implementation=functools.partial(<function delegate>, attribute='_fill_created', key='author.time')), 'onyo.was.created.committer.email': PseudoKey(description='Email of the committer of the commit that created the item.', implementation=functools.partial(<function delegate>, attribute='_fill_created', key='committer.email')), 'onyo.was.created.committer.name': PseudoKey(description='Name of the committer of the commit that created the item.', implementation=functools.partial(<function delegate>, attribute='_fill_created', key='committer.name')), 'onyo.was.created.hexsha': PseudoKey(description='SHA of the commit that created the item.', implementation=functools.partial(<function delegate>, attribute='_fill_created', key='hexsha')), 'onyo.was.created.time': PseudoKey(description='Time of the commit that created the item.', implementation=functools.partial(<function delegate>, attribute='_fill_created', key='time')), 'onyo.was.modified.author.email': PseudoKey(description='Email of the author of the most recent commit that modified the item.', implementation=functools.partial(<function delegate>, attribute='_fill_modified', key='author.email')), 'onyo.was.modified.author.name': PseudoKey(description='Name of the author of the most recent commit that modified the item.', implementation=functools.partial(<function delegate>, attribute='_fill_modified', key='author.time')), 'onyo.was.modified.committer.email': PseudoKey(description='Email of the committer of the most recent commit that modified the item.', implementation=functools.partial(<function delegate>, attribute='_fill_modified', key='committer.email')), 'onyo.was.modified.committer.name': PseudoKey(description='Name of the committer of the most recent commit that modified the item.', implementation=functools.partial(<function delegate>, attribute='_fill_modified', key='committer.name')), 'onyo.was.modified.hexsha': PseudoKey(description='SHA of the most recent commit that modified the item.', implementation=functools.partial(<function delegate>, attribute='_fill_modified', key='hexsha')), 'onyo.was.modified.time': PseudoKey(description='Time of the most recent commit that modified the item.', implementation=functools.partial(<function delegate>, attribute='_fill_modified', key='time'))}

Addressable keys that are not part of the on-disk asset YAML.

For example, git commit metadata and path information.

All PSEUDO_KEYS are reserved.

See also

RESERVED_KEYS

class onyo.lib.pseudokeys.PseudoKey(description, implementation)[source]

Bases: object

“Define a pseudo-key implementation.

__init__(description, implementation)
description: str

Description of the pseudo-key’s value.

implementation: Callable

Callable to populate the pseudo-key’s value when it is undefined.

The Callable is expected to accept a single parameter of type onyo.lib.items.Item.

onyo.lib.pseudokeys.delegate(self, attribute, *args, **kwargs)[source]

Call function attribute and pass all args.

To avoid circular imports between this file and :py:data`onyo.lib.inventory.OPERATIONS_MAPPING`.