blenderproc.python.modules.utility.ConfigParser module

class blenderproc.python.modules.utility.ConfigParser.ConfigParser(silent=False)[source]

Bases: object

_check_version()[source]

Checks if the configuration file contain a valid version number and if its up to date.

_fill_placeholder_at_path(path, old, new)[source]

Replaces the given placeholder with the given value at the given path

Parameters:
  • path – A path list which leads to the config value that contains the placeholder.
  • old – The string to replace
  • new – The string to replace it with
_fill_placeholders_in_config(skip_arg_placeholders)[source]

Replaces all placeholders with their corresponding values

_form_argument_usage_string(type, key, usages)[source]

Forms string containing placeholder and all its usage paths.

e.q. <args:1>: Used in key1/key2, modules/1/name

Parameters:
  • type – The type of the placeholder.
  • key – The of the placeholder (e.q. argument index or env var name)
  • usages – A list of path lists. Where a path list looks like [“key1”, “key2”].
Returns:

The final string

_parse_placeholders_in_block(element, path=[])[source]

Collects all placeholders in the given block.

Parameters:
  • element – A dict / list / string which describes an element in the config block.
  • path – A list of keys describing the path to the given block in the total config. e.q. [“modules”, 0, “name”] means block = config[“modules”][0][“name”]
Returns:

A list of dicts, where each dict describes a placeholder

_placeholder_path_to_string(path)[source]

Forms a string out of a path list.

[“key1”, “key2”] -> key1/key2

Also inserts module names for better readability.

Parameters:path – A path list. e.q. [“key1”, “key2”].
Returns:The path string.
_print_placeholders(placeholders, type_header)[source]

Print the give given placeholders grouped by typed and by key.

Parameters:
  • placeholders – A list of dicts, where every dict describes one placeholder.
  • type_header – A dict which maps every type to a string which will be printed in front of the list of placeholders with the type.
_show_help()[source]

Print out help message which describes the placeholders that are used in the given config file

log(message, is_info=False)[source]

Prints the given message.

Parameters:
  • message – The message string.
  • is_info – True, if this message is only debug information.
parse(config_path, args, show_help=False, skip_arg_placeholders=False)[source]

Reads the yaml file at the given path and returns it as a cleaned dict.

Removes all comments and replaces arguments and env variables with their corresponding values.

Parameters:
  • config_path – The path to the yaml file.
  • args – A list with the arguments which should be used for replacing <args:i> templates inside the config.
  • show_help – If True, shows a help message which describes the placeholders that are used in the given config file. Exits the program afterwards.
  • skip_arg_placeholders – If true, disregards filling up non environment type arguments.
Returns:

The dict containing the configuration.

class blenderproc.python.modules.utility.ConfigParser.PlaceholderTypes[source]

Bases: enum.Enum

An enumeration.

ARG = 1
ENV = 2