avocado_varianter_yaml_to_mux package¶
Submodules¶
avocado_varianter_yaml_to_mux.mux module¶
This file contains mux-enabled implementations of parts useful for creating a custom Varianter plugin.
- class avocado_varianter_yaml_to_mux.mux.Control(code, value=None)¶
Bases:
object
Container used to identify node vs. control sequence
- class avocado_varianter_yaml_to_mux.mux.MuxPlugin¶
Bases:
object
Base implementation of Mux-like Varianter plugin. It should be used as a base class in conjunction with
avocado.core.plugin_interfaces.Varianter
.- initialize_mux(root, paths)¶
Initialize the basic values
- Note
We can’t use __init__ as this object is intended to be used via dispatcher with no __init__ arguments.
- paths = None¶
- root = None¶
- to_str(summary, variants, **kwargs)¶
- variant_ids = []¶
- variants = None¶
- class avocado_varianter_yaml_to_mux.mux.MuxTree(root)¶
Bases:
object
Object representing part of the tree from the root to leaves or another multiplex domain. Recursively it creates multiplexed variants of the full tree.
- Parameters
root – Root of this tree slice
- iter_variants()¶
Iterates through variants without verifying the internal filters
:yield all existing variants
- class avocado_varianter_yaml_to_mux.mux.MuxTreeNode(name='', value=None, parent=None, children=None)¶
Bases:
avocado.core.tree.TreeNode
Class for bounding nodes into tree-structure with support for multiplexation
- Parameters
name (str) – a name for this node that will be used to define its path according to the name of its parents
value (dict) – a collection of keys and values that will be made into this node environment.
parent (
TreeNode
) – the node that is directly above this one in the tree structurechildren (builtin.list) – the nodes that are directly beneath this one in the tree structure
- fingerprint()¶
Reports string which represents the value of this node.
- merge(other)¶
Merges other node into this one without checking the name of the other node. New values are appended, existing values overwritten and unaffected ones are kept. Then all other node children are added as children (recursively they get either appended at the end or merged into existing node in the previous position.
- class avocado_varianter_yaml_to_mux.mux.OutputList(values, nodes, yamls)¶
Bases:
list
List with some debug info
- class avocado_varianter_yaml_to_mux.mux.OutputValue(value, node, srcyaml)¶
Bases:
object
Ordinary value with some debug info
- class avocado_varianter_yaml_to_mux.mux.ValueDict(srcyaml, node, values)¶
Bases:
dict
Dict which stores the origin of the items
- items()¶
Slower implementation with the use of __getitem__
- avocado_varianter_yaml_to_mux.mux.apply_filters(root, filter_only=None, filter_out=None)¶
Apply a set of filters to the tree.
The basic filtering is filter only, which includes nodes, and the filter out rules, that exclude nodes.
Note that filter_out is stronger than filter_only, so if you filter out something, you could not bypass some nodes by using a filter_only rule.
- Parameters
root – Root node of the multiplex tree.
filter_only – the list of paths which will include nodes.
filter_out – the list of paths which will exclude nodes.
- Returns
the original tree minus the nodes filtered by the rules.
- avocado_varianter_yaml_to_mux.mux.path_parent(path)¶
From a given path, return its parent path.
- Parameters
path – the node path as string.
- Returns
the parent path as string.
Module contents¶
Varianter plugin to parse yaml files to params
- class avocado_varianter_yaml_to_mux.ListOfNodeObjects(iterable=(), /)¶
Bases:
list
Used to mark list as list of objects from whose node is going to be created
- class avocado_varianter_yaml_to_mux.YamlToMux¶
Bases:
avocado_varianter_yaml_to_mux.mux.MuxPlugin
,avocado.core.plugin_interfaces.Varianter
Processes the mux options into varianter plugin
- description = 'Multiplexer plugin to parse yaml files to params'¶
- initialize(config)¶
- name = 'yaml_to_mux'¶
- class avocado_varianter_yaml_to_mux.YamlToMuxCLI¶
Bases:
avocado.core.plugin_interfaces.CLI
Defines arguments for YamlToMux plugin
- configure(parser)¶
Configures “run” and “variants” subparsers
- description = "YamlToMux options for the 'run' subcommand"¶
- name = 'yaml_to_mux'¶
- run(config)¶
The YamlToMux varianter plugin handles these
- class avocado_varianter_yaml_to_mux.YamlToMuxInit¶
Bases:
avocado.core.plugin_interfaces.Init
YamlToMux initialization plugin
- description = 'YamlToMux initialization plugin'¶
- initialize()¶
Entry point for the plugin to perform its initialization.
- name = 'yaml_to_mux'¶
- avocado_varianter_yaml_to_mux.create_from_yaml(paths)¶
Create tree structure from yaml-like file.
- Parameters
paths – File object to be processed
- Raises
SyntaxError – When yaml-file is corrupted
- Returns
Root of the created tree structure