spawn.parsers

Parsers for spawn spec files

This module contains any classes, functions and utilities related to parsing data

class spawn.parsers.DictSpecificationProvider(spec)[source]

Implementation of SpecificationDescriptionProvider that reads the specification from a provided dict

get()[source]

Gets the specification

Returns

A dict representation of the description

Return type

dict

class spawn.parsers.SpecificationDescriptionProvider[source]

Abstract base class for implementations that provide the specification description.

get()[source]

Gets the specification description

Returns

A dict representation of the description

Return type

dict

class spawn.parsers.SpecificationFileReader(input_file)[source]

Implementation of SpecificationDescriptionProvider that reads the specification from a file

get()[source]

Reads the specification description from a file

Returns

A dict representation of the description

Return type

dict

class spawn.parsers.SpecificationNodeParser(value_proxy_parser, combinators=None, default_combinator=None)[source]

Expands the specification nodes, starting at the node_spec provided

Given a starting node_spec, the specification node_spec parser assesses child nodes and expands them according to their values.

parse(node_spec, parent=None, node_policies=None, ghost_parameters=None)[source]

Parse the node_spec, and expand its children.

This iterates through a node_spec and expands it’s children.

Parameters
  • node_spec (dict) – A node specification

  • parent (SpecificationNode) – A specification node to add the new nodes to

Returns

The expanded node_spec

Return type

SpecificationNode

class spawn.parsers.SpecificationParser(plugin_loader)[source]

Class for parsing specifications

Given a specification provider, the SpecificationParser will get the specification and produce a tree representation of the nodes.

parse(description)[source]

Parse the specification description

Reads the metadata from the file and creates any required value libraries, before initialising a SpecificationNodeParser to expand the nodes defined in the description.

Parameters

description (dict) – The specification description

Returns

An object representing the expanded specification tree.

Return type

SpecificationModel

class spawn.parsers.ValueLibraries(generators=None, macros=None, evaluators=None)[source]

Container class for value libraries (generators, macros & evaluators)

copy()[source]

Copies the values library

Returns

A copy of this object

Return type

ValueLibraries

property evaluators

Evaluators library

property generators

Generators library

property macros

Macros library