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.

debug = None
default_params = None
initialize_mux(root, mux_path, debug)

Initialize the basic values

Note:We can’t use __init__ as this object is intended to be used via dispatcher with no __init__ arguments.
mux_path = None
root = None
to_str(summary, variants, **kwargs)

See avocado.core.plugin_interfaces.Varianter.to_str()

update_defaults(defaults)

See avocado.core.plugin_interfaces.Varianter.update_defaults()

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

fingerprint()
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.MuxTreeNodeDebug(name='', value=None, parent=None, children=None, srcyaml=None)

Bases: avocado_varianter_yaml_to_mux.mux.MuxTreeNode, avocado.core.tree.TreeNodeDebug

Debug version of TreeNodeDebug :warning: Origin of the value is appended to all values thus it’s not suitable for running tests.

merge(other)
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

Bases: list

Used to mark list as list of objects from whose node is going to be created

class avocado_varianter_yaml_to_mux.MappingDict

Bases: dict

Object representing mapping

class avocado_varianter_yaml_to_mux.Value

Bases: tuple

Used to mark values to simplify checking for node vs. value

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(args)
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(args)

The YamlToMux varianter plugin handles these

avocado_varianter_yaml_to_mux.create_from_yaml(paths, debug=False)

Create tree structure from yaml-like file :param fileobj: File object to be processed :raise SyntaxError: When yaml-file is corrupted :return: Root of the created tree structure