Config Parser

paperplane.parser.config._parse(config: dict) → OrderedDict

Validate and parse the config.

Parameters

config (dict) – The config to work upon

Returns

A parsed config object

Return type

OrderedDict

paperplane.parser.config._validate_and_fix_prompt(key: str, params: dict) → None

If no prompt is provided, use “Enter {key}:” as the prompt.

Modifies the params dict in-place.

Parameters
  • key (str) – Key of the I/O block object

  • params (dict) – Params for the I/O block object

Returns

None

Return type

NoneType

paperplane.parser.config._validate_and_fix_type(backend: str, key: str, params: dict) → None

If params.type doesn’t specify a backend, modify it to insert the given backend.

Modifies the params dict in-place.

Parameters
  • backend (str) – The backend that should be used if params.type doesn’t already specify a backend

  • key (str) – Key of the I/O block object

  • params (dict) – Params for the I/O block object

Returns

None

Return type

NoneType

paperplane.parser.config.from_json(json_string: str) → dict

Load the given JSON string into a dict

Parameters

json_string (str) – JSON string to work on

Returns

dict representation of the given JSON string

Return type

dict

paperplane.parser.config.from_yml(yml_string: str) → dict

Load the given YAML string into a dict

Parameters

yml_string (str) – YAML string to work on

Returns

dict representation of the given YAML string

Return type

dict