YAML- and JSON-format input files

In its new input format, APBS accepts either JSON- or YAML-format input files.

These input files consist of the following keywords and objects:

Input file class structure

The input file object parsing and validation follows the basic pattern implemented in apbs.input_file.InputFile (see below). This class should serve as a template for adding new input file sections.

Input file parsing classes.

class apbs.input_file.InputFile(dict_=None, yaml=None, json=None)[source]

Bases: abc.ABC

Base class for input file classes.

from_dict(input_)[source]

Parse dictionary-format input into this object.

Parameters:input (dict) – input dictionary
Raises:KeyError – when input is missing
from_json(input_)[source]

Parse JSON-format input string into this object.

Parameters:input (str) – JSON-format input string
from_yaml(input_)[source]

Parse YAML-format input string into this object.

Parameters:input (str) – YAML-format input string
to_dict() → dict[source]

Produce dictionary representation of self.

to_json() → str[source]

Produce JSON representation of self.

to_yaml() → str[source]

Produce YAML representation of self.

validate()[source]

Validate the object.

Raises:ValueError – if object is not valid