def _strip_new_lines_chars(self, line): """ Method to delete new line chars and other chars we don not need to parse in on_new_line (color escape character) :param line: Line with special chars, raw string from device :return: line without special chars. """ line = super(GenericUnixCommand, self)._strip_new_lines_chars(line) if self.remove_colors_from_terminal_output: line = remove_escape_codes(line) return line
def _decode_line(self, line): """ Method to delete new line chars and other chars we don not need to parse in on_new_line (color escape character) :param line: Line with special chars, raw string from device :return: line without special chars. """ if self.remove_colors_from_terminal_output: line = remove_escape_codes(line) return line
def _strip_new_lines_chars(self, line): line = super(GenericUnixCommand, self)._strip_new_lines_chars(line) if self.remove_colors_from_terminal_output: line = remove_escape_codes(line) return line
def test_escape_cursors(): from moler.helpers import remove_escape_codes raw_line = "\x1B7\x1B[0;100r\x1B8\x1B[1A\x1B[Jmoler_bash#" expected_line = "moler_bash#" line = remove_escape_codes(raw_line) assert expected_line == line