Parser#

class Parser(filename, mode='r')[source]#

Bases: ABC

Base class for structure file parsers.

Classes inheriting from Parser need to define a parse_input method that accepts a list of lines and returns a dictionary representation of the data.

Methods

Parser.get(key, default)

Retrieve a value from the internal data using a given key.

Parser.items()

List items available in internal dictionary.

Parser.keys()

List keys available in internal dictionary.

Parser.parse_input(lines)

Parse a list of lines from a file and convert the data into a dictionary.

Parser.values()

List values available in internal dictionary.