polyfemos.back.filewriter.FileWriter¶
-
class
polyfemos.back.filewriter.
FileWriter
(bool_=False, fp_func=None, retroactive=False)[source]¶ Bases:
object
Parent 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_func
is set towrite_csv()
.self._create_line_func
is set tocreate_csvline()
.- Parameters
bool_ (bool) – If
False
, methods of this class do nothing, Iffp_func
is not callable,bool_
is set toFalse
fp_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
args
are 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
args
are 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
filename
inself._dict
, header is added to the corersponding file entry inself._dict
.
-
get_filename
(pathkwargs)[source]¶ Applies
pathkwargs
toself._filepath_func
and returns the resulting filepath. If retroactive mode is used, ‘retro’ identifier is added to the filepath.
-