예제 #1
0
    def __init__(self, show_header: bool = True, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # Set the width to constant to pipe whole output from console
        self._width = 200 if not is_tty() else self._width

        # If show header in tables
        self.show_header = show_header
예제 #2
0
    def __str__(self):
        result = f"{self.msg}\nFilename: {self.file_path}\n\n"

        for error_no, parse_error in enumerate(self.parse_errors, 1):
            result += "=" * 20 + f" Parse error {error_no:3} " + "=" * 20 + "\n"
            result += f"{parse_error.message}\n"
            if parse_error.line_no:
                result += f"Line number:  {parse_error.line_no}\n"
                if parse_error.line_no and is_tty():
                    result += "\n" + prepare_code_snippet(self.file_path, parse_error.line_no) + "\n"

        return result
예제 #3
0
    def __str__(self):
        result = self.msg + "\nFilename: " + self.file_path + "\n\n"

        for error_no, parse_error in enumerate(self.parse_errors, 1):
            result += "=" * 20 + " Parse error {error_no:3} ".format(
                error_no=error_no) + "=" * 20 + "\n"
            result += parse_error.message + "\n"
            if parse_error.line_no:
                result += "Line number:  {}\n".format(parse_error.line_no)
                if parse_error.line_no and is_tty():
                    result += "\n" + prepare_code_snippet(
                        self.file_path, parse_error.line_no) + "\n"

        return result
예제 #4
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     # Set the width to constant to pipe whole output from console
     self._width = 200 if not is_tty() else self._width