pycgtool.parsers.cfg

Module containing classes used to parse custom CFG file format.

Format is based upon GROMACS .itp files but does not support nesting of sections.

Module Contents

Classes

CFG

Class representing a CFG file using a format similar to a GROMACS .itp file.

Attributes

PathLike

pycgtool.parsers.cfg.PathLike
exception pycgtool.parsers.cfg.DuplicateSectionError(section, filename)[source]

Bases: KeyError

Exception used to indicate that a section has appeared twice in a file.

exception pycgtool.parsers.cfg.NoSectionError(filename)[source]

Bases: KeyError

Exception used to indicate that a file contains no sections.

class pycgtool.parsers.cfg.CFG(filepath: Optional[PathLike] = None)[source]

Bases: collections.OrderedDict, contextlib.AbstractContextManager

Class representing a CFG file using a format similar to a GROMACS .itp file.

Contains a dictionary of Sections.

_read_line(self, line: str, filepath: pathlib.Path)str[source]
_read_file(self, filepath: pathlib.Path)None[source]
__exit__(self, exc_type, exc_value, traceback)[source]

Raise any exception triggered within the runtime context.