pyTooling.Configuration.YAML

Configuration reader for YAML files.

Hint

See high-level help for explanations and usage examples.

Classes

  • Node: Abstract node in a configuration data structure.

  • Dictionary: A dictionary node in a YAML data file.

  • Sequence: A sequence node (ordered list) in a YAML data file.

  • Configuration: A configuration read from a YAML file.


Classes

class pyTooling.Configuration.YAML.Node(root, parent, key, yamlNode)[source]

Inheritance

Inheritance diagram of Node

Parameters:
__init__(root, parent, key, yamlNode)[source]

Initializes a node.

Parameters:
Return type:

None

__len__()[source]

Returns the number of sub-elements.

Return type:

int

Returns:

Number of sub-elements.

DICT_TYPE

alias of Dictionary

class property HasClassAttributes: bool

Check if class has Attributes.

Returns:

True, if the class has Attributes.

class property HasMethodAttributes: bool

Check if class has any method with Attributes.

Returns:

True, if the class has any method with Attributes.

SEQ_TYPE

alias of Sequence

_parent: Dictionary

Reference to a parent node.

_root: Configuration

Reference to the root node.

class pyTooling.Configuration.YAML.Dictionary(root, parent, key, yamlNode)[source]

A dictionary node in a YAML data file.

Inheritance

Inheritance diagram of Dictionary

Parameters:
__init__(root, parent, key, yamlNode)[source]

Initializes a dictionary.

Parameters:
Return type:

None

DICT_TYPE

alias of Dictionary

class property HasClassAttributes: bool

Check if class has Attributes.

Returns:

True, if the class has Attributes.

class property HasMethodAttributes: bool

Check if class has any method with Attributes.

Returns:

True, if the class has any method with Attributes.

SEQ_TYPE

alias of Sequence

__len__()

Returns the number of sub-elements.

Return type:

int

Returns:

Number of sub-elements.

_parent: Dictionary

Reference to a parent node.

_root: Configuration

Reference to the root node.

class pyTooling.Configuration.YAML.Sequence(root, parent, key, yamlNode)[source]

A sequence node (ordered list) in a YAML data file.

Inheritance

Inheritance diagram of Sequence

Parameters:
__init__(root, parent, key, yamlNode)[source]

Initializes a sequence.

Parameters:
Return type:

None

DICT_TYPE

alias of Dictionary

class property HasClassAttributes: bool

Check if class has Attributes.

Returns:

True, if the class has Attributes.

class property HasMethodAttributes: bool

Check if class has any method with Attributes.

Returns:

True, if the class has any method with Attributes.

SEQ_TYPE

alias of Sequence

__iter__()[source]

Returns an iterator to iterate items in the sequence of sub-nodes.

Return type:

Iterator[Union[Dictionary, Sequence, str, int, float]]

Returns:

Iterator to iterate items in a sequence.

__len__()

Returns the number of sub-elements.

Return type:

int

Returns:

Number of sub-elements.

_parent: Dictionary

Reference to a parent node.

_root: Configuration

Reference to the root node.

class pyTooling.Configuration.YAML.Configuration(configFile)[source]

A configuration read from a YAML file.

Inheritance

Inheritance diagram of Configuration

Parameters:

configFile (Path)

DICT_TYPE

alias of Dictionary

class property HasClassAttributes: bool

Check if class has Attributes.

Returns:

True, if the class has Attributes.

class property HasMethodAttributes: bool

Check if class has any method with Attributes.

Returns:

True, if the class has any method with Attributes.

SEQ_TYPE

alias of Sequence

__len__()

Returns the number of sub-elements.

Return type:

int

Returns:

Number of sub-elements.

_parent: Dictionary

Reference to a parent node.

_root: Configuration

Reference to the root node.

__init__(configFile)[source]

Initializes a configuration instance that reads a YAML file as input.

All sequence items or dictionaries key-value-pairs in the YAML file are accessible via Python’s dictionary syntax.

Parameters:

configFile (Path) – Configuration file to read and parse.

Return type:

None

__getitem__(key)[source]

Access a configuration node by key.

Parameters:

key (str) – The key to look for.

Return type:

Union[Dictionary, Sequence, str, int, float]

Returns:

A node (sequence or dictionary) or scalar value (int, float, str).