Plugins/CheckerPlugins/CodeStyleChecker/pep8.py

changeset 3670
f0cb7579c0b4
parent 3629
98e90f613114
child 4021
195a471c327b
equal deleted inserted replaced
3669:ac84ac3c0f05 3670:f0cb7579c0b4
48 """ 48 """
49 from __future__ import with_statement 49 from __future__ import with_statement
50 50
51 # 51 #
52 # This is a modified version to make the original pep8.py better suitable 52 # This is a modified version to make the original pep8.py better suitable
53 # for being called from within the eric5 IDE. The modifications are as 53 # for being called from within the eric6 IDE. The modifications are as
54 # follows: 54 # follows:
55 # 55 #
56 # - made messages translatable via Qt 56 # - made messages translatable via Qt
57 # - added code for eric5 integration 57 # - added code for eric6 integration
58 # 58 #
59 # Copyright (c) 2011 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> 59 # Copyright (c) 2011 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
60 # 60 #
61 61
62 __version__ = '1.5.6' 62 __version__ = '1.5.6'
1259 self.lines[0] = self.lines[0][3:] 1259 self.lines[0] = self.lines[0][3:]
1260 self.report = report or options.report 1260 self.report = report or options.report
1261 self.report_error = self.report.error 1261 self.report_error = self.report.error
1262 self.report_error_args = self.report.error_args 1262 self.report_error_args = self.report.error_args
1263 1263
1264 # added for eric5 integration 1264 # added for eric6 integration
1265 self.options = options 1265 self.options = options
1266 1266
1267 def report_invalid_syntax(self): 1267 def report_invalid_syntax(self):
1268 """Check if the syntax is valid.""" 1268 """Check if the syntax is valid."""
1269 (exc_type, exc) = sys.exc_info()[:2] 1269 (exc_type, exc) = sys.exc_info()[:2]
1375 try: 1375 try:
1376 tree = compile(''.join(self.lines), '', 'exec', ast.PyCF_ONLY_AST) 1376 tree = compile(''.join(self.lines), '', 'exec', ast.PyCF_ONLY_AST)
1377 except (SyntaxError, TypeError): 1377 except (SyntaxError, TypeError):
1378 return self.report_invalid_syntax() 1378 return self.report_invalid_syntax()
1379 for name, cls, __ in self._ast_checks: 1379 for name, cls, __ in self._ast_checks:
1380 # extended API for eric5 integration 1380 # extended API for eric6 integration
1381 checker = cls(tree, self.filename, self.options) 1381 checker = cls(tree, self.filename, self.options)
1382 for args in checker.run(): 1382 for args in checker.run():
1383 lineno = args[0] 1383 lineno = args[0]
1384 if not self.lines or not noqa(self.lines[lineno - 1]): 1384 if not self.lines or not noqa(self.lines[lineno - 1]):
1385 self.report_error_args(lineno, *args[1:]) 1385 self.report_error_args(lineno, *args[1:])

eric ide

mercurial