bsb.config.parsers package

Module contents

class bsb.config.parsers.ConfigurationParser[source]
abstractmethod generate(tree, pretty=False)[source]

Generate a string representation of the configuration tree (dictionary).

Parameters:
  • tree (dict) – configuration tree

  • pretty (bool) – if True, will add indentation to the output string

Returns:

str representation of the configuration tree

Return type:

str

abstractmethod parse(content, path=None)[source]

Parse configuration file content.

Parameters:
  • content – str or dict content of the file to parse

  • path – path to the file containing the configuration.

Returns:

configuration tree and metadata attached as dictionaries

class bsb.config.parsers.ParsesReferences[source]

Mixin to decorate parse function of ConfigurationParser.

Allows for imports and references inside configuration files.

bsb.config.parsers.get_configuration_parser(parser, **kwargs)[source]

Create an instance of a configuration parser that can parse configuration strings into configuration trees, or serialize trees into strings.

Configuration trees can be cast into Configuration objects.