betterSIS History Utils Code Documentation¶
BETTERSIS.HISTORY_UTILS: Defines functions to keep control of the size of the history file.
- bettersis.history_utils.limit_history_size(t_file, t_size_limit, t_output=None)[source]¶
Limits the size of
<t_file>to<t_size_limit>bytes/chars. If<t_output>is set the output is the<t_output>file, else the<t_file>is overwritten.- Parameters
t_file (str) – path of the file of which to limit its size
t_size_limit (int) – limit of
<t_file>sizet_output (str) – output file path (if equal to None
<t_file>gets modified in place)
- bettersis.history_utils.remove_blank_lines(t_input, t_output)[source]¶
Reads a file and rewrites its content skipping blank lines.
- Parameters
t_input (str) – path to the input file
t_output (str) – path to the output file
- bettersis.history_utils.truncate_beginning(t_input, t_output, t_limit)[source]¶
Removes the first chars/bytes from the
<t_input>file and saves the last<t_limit>bytes inside the<t_output>file.- Parameters
t_input (str) – path to the input file
t_output (str) – path to the output file
t_limit (int) – number of chars/bytes to keep from the end of the file