Skip to content

pyheaderconfigobj

The main easyconfig format class

Authors:

  • Stijn De Weirdt (Ghent University)
  • Kenneth Hoste (Ghent University)

EasyConfigFormatConfigObj

Bases: EasyConfigFormat

Extended EasyConfig format, with support for a header and sections that are actually parsed (as opposed to exec'ed). It's very limited for now, but is already huge improvement.

3 parts in easyconfig file: - header (^# style) - pyheader (including docstring) - contents is exec'ed, docstring and remainder are extracted - begin of regular section until EOF - feed to ConfigObj

__init__(*args, **kwargs)

Extend EasyConfigFormat with some more attributes

parse(txt, strict_section_markers=False)

Pre-process txt to extract header, docstring and pyheader Then create the configobj instance by parsing the remainder

parse_header(header)

Parse the header, assign to self.header

parse_pre_section(txt)

Parse the text block before the start of the first section

parse_pyheader(pyheader)

Parse the python header, assign to docstring and cfg

parse_section_block(section)

Parse the section block by trying to convert it into a ConfigObj instance

pyheader_env()

Create the global/local environment to use with eval/execfile

build_easyconfig_constants_dict()

Make a dictionary with all constants that can be used

build_easyconfig_variables_dict()

Make a dictionary with all variables that can be used