yaml_include.funcs module

yaml_include.funcs.load(obj: Any, loader_type: Type[YAML_Loader | YAML_CLoader], constructor: Constructor, inplace: bool = False, nested: bool = False) Any[source]

Recursively load and parse all Data instances inside obj.

If Constructor.autoload is False, yaml.load() will not cause including files to be opened or read, in the situation, what returned by yaml.load() is an object with Data in it, and the files won’t be processed. Thus we use the function to open and parse those including files represented by Data instances inside obj.

Parameters:
  • obj (Any) – object containers Data

  • loader_type (Type[Union[YAML_Loader, YAML_CLoader]]) – use this type of PyYAML Loader to parse string in including file(s)

  • constructor (Constructor) – use this Constructor to find/open/read including file(s)

  • inplace (bool) – whether to make a in-place replacement for every Constructor instance in obj

  • nested (bool) – whether to parse and load lower level include statement(s) inside Constructor instance

Returns:

Parsed object

Return type:

Any

yaml_include.funcs.lazy_load(obj: Any, loader_type: Type[YAML_Loader | YAML_CLoader], constructor: Constructor, nested: bool = False) Generator[Any, None, Any][source]

Recursively load and parse all Data inside obj in generative mode.

Almost the same as load(), except that:

  • The function returns a generator, it yields at every Data instance found in side obj.

  • It only applies an in-place parsing and replacement, and will not return parsed object.

Parameters:
  • obj (Any)

  • loader_type (Type[Union[YAML_Loader, YAML_CLoader]])

  • constructor (Constructor)

  • nested (bool)

Return type:

Generator[Any, None, Any]