Parser#

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

Bases: ABC

Base class for structure file parsers.

Classes inheriting from Parser need to define a function Parser.parse_input() that creates a dictionary representation of the given file. The input is a deque of all lines in the file.

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.