swarmsim.yaml.include#

Handles !include and !relpath tags

class swarmsim.yaml.include.IncludeLoader(self, stream: IO)[source]#

YAML Loader with !include constructor.

swarmsim.yaml.include.search_file(parent_path: PathLike, path_str: PathLike) Path[source]#

Include file referenced at node.

resolve order:

  1. absolute or resolvable/home paths (i.e. ~/foo.yaml)

  2. relative to yaml file

  3. relative to cwd

see Our YAML module for an example

swarmsim.yaml.include.construct_include(loader: IncludeLoader, node: Node) Any[source]#

Read the contents of a yaml/text/json file into a node

swarmsim.yaml.include.construct_relative_path(loader: IncludeLoader, node: Node) str[source]#

Construct a path which is resolved absolutely or relative to the yaml file

swarmsim.yaml.include.INCLUDE_TAG = '!include'[source]#

YAML tag for !include

Type:

str

swarmsim.yaml.include.RELPATH_TAG = '!relpath'[source]#

YAML tag for !relpath

Type:

str

Module Attributes

INCLUDE_TAG

YAML tag for !include

RELPATH_TAG

YAML tag for !relpath

Functions

construct_include(loader, node)

Read the contents of a yaml/text/json file into a node

construct_relative_path(loader, node)

Construct a path which is resolved absolutely or relative to the yaml file

search_file(parent_path, path_str)

Include file referenced at node.

Classes

IncludeLoader(stream)

YAML Loader with !include constructor.