polyfemos.back.filewriter.FileWriter¶
-
class
polyfemos.back.filewriter.FileWriter(bool_=False, fp_func=None, retroactive=False)[source]¶ Bases:
objectParent class for state of health file writer classes
Public Methods
-
__init__(bool_=False, fp_func=None, retroactive=False)[source]¶ The attribute values are suitable for writing state of health csv files by default.
self._file_writing_funcis set towrite_csv().self._create_line_funcis set tocreate_csvline().- Parameters
bool_ (bool) – If
False, methods of this class do nothing, Iffp_funcis not callable,bool_is set toFalsefp_func (func) – filepath function, e.g. FLAGs ‘sohtextfilepath’ ‘sohalertpath’ or ‘sohcsvpath’. See
_init_flags()for more information.retroactive (bool) – defines if the retroactive mode is used. See
_init_flags()for more info.
-
append_and_write_data(filename, *args)[source]¶ Additional arguments
argsare applied to the functionself._create_line_func.Creates and immediately writes a new line to file
filename.- Parameters
filename (str) –
-
append_data(filename, *args)[source]¶ Additional arguments
argsare applied to the functionself._create_line_func.Creates and appends a new line to file entry (
filename) inself._dict.- Parameters
filename (str) –
-
append_line(filename, line)[source]¶ If there is no file with a name
filenameinself._dict, header is added to the corersponding file entry inself._dict.
-
get_filename(pathkwargs)[source]¶ Applies
pathkwargstoself._filepath_funcand returns the resulting filepath. If retroactive mode is used, ‘retro’ identifier is added to the filepath.
-