File Module
A generic module used by all file format modules (for example FileXml for loading and saving ERACS data to/from XML file formats). It contains a TEracsFile class containing base logic for loading and saving ERACS files. File is used behind-the-scenes by Data, and is the best way of populating the ERACS Python Interface with data.
- class TEracsFile
Generic file class for providing base logic for loading and saving ERACS data files.
- Inherits
- Load(AFilePathAndName, ATrySameName)
Loads data from the specified file. Clears previous data to make space for the next set of data.
- Parameters
AFilePathAndName (str) – The file to load, must have the appropriate extension.
- Returns
True if successful
- Raises
TEracsArgumentError – If the file doesn’t exist or has the incorrect extension.
- Save(AFilePathAndName)
Saves data to a specified file path/name. Must be overridden by descendant.
- Parameters
AFilePathAndName (str) – The file to save, must have the appropriate extension.
- Returns
True if successful
- Raises
TEracsArgumentError – If filename has an unsupported extension.
- class TEracsRange(AKey, AStart, AEnd)
A range for a data field. Every data field has a key, a start column index, and an end colum index.
- property Key
The key of the column.
- Type
str.
- Writable
False.
- property Start
The starting column index (inclusive).
- Type
int.
- Writable
False.
- property End
The ending column index (inclusive).
- Type
int.
- Writable
False.
- class TEracsElement(ARanges)
Represents a generic element for data files (CSV, IEEE, etc.). Contains a list of data field ranges.
- ToDict(AString)
Takes a string, and turns it into a dictionary using the ranges.
- Parameters
AString (str) – The string of data to be turned into a dictionary.
- Returns
A dictionary containing all data.