1376 elif self.lines[0][:3] == '\xef\xbb\xbf': |
1376 elif self.lines[0][:3] == '\xef\xbb\xbf': |
1377 self.lines[0] = self.lines[0][3:] |
1377 self.lines[0] = self.lines[0][3:] |
1378 self.report = report or options.report |
1378 self.report = report or options.report |
1379 self.report_error = self.report.error |
1379 self.report_error = self.report.error |
1380 self.report_error_args = self.report.error_args |
1380 self.report_error_args = self.report.error_args |
|
1381 |
|
1382 # added for eric5 integration |
|
1383 self.options = options |
1381 |
1384 |
1382 def report_invalid_syntax(self): |
1385 def report_invalid_syntax(self): |
1383 exc_type, exc = sys.exc_info()[:2] |
1386 exc_type, exc = sys.exc_info()[:2] |
1384 if len(exc.args) > 1: |
1387 if len(exc.args) > 1: |
1385 offset = exc.args[1] |
1388 offset = exc.args[1] |
1506 try: |
1509 try: |
1507 tree = compile(''.join(self.lines), '', 'exec', PyCF_ONLY_AST) |
1510 tree = compile(''.join(self.lines), '', 'exec', PyCF_ONLY_AST) |
1508 except (SyntaxError, TypeError): |
1511 except (SyntaxError, TypeError): |
1509 return self.report_invalid_syntax() |
1512 return self.report_invalid_syntax() |
1510 for name, cls, _ in self._ast_checks: |
1513 for name, cls, _ in self._ast_checks: |
1511 checker = cls(tree, self.filename) |
1514 # extended API for eric5 integration |
|
1515 checker = cls(tree, self.filename, self.options) |
1512 for lineno, offset, code, check, *args in checker.run(): |
1516 for lineno, offset, code, check, *args in checker.run(): |
1513 if not noqa(self.lines[lineno - 1]): |
1517 if not noqa(self.lines[lineno - 1]): |
1514 self.report_error_args(lineno, offset, code, check, *args) |
1518 self.report_error_args(lineno, offset, code, check, *args) |
1515 |
1519 |
1516 def generate_tokens(self): |
1520 def generate_tokens(self): |