Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py

changeset 3210
8f4fe6f76729
parent 3165
400234200cd6
child 3484
645c12de6b0c
equal deleted inserted replaced
3208:884465a61753 3210:8f4fe6f76729
21 import tokenize 21 import tokenize
22 import ast 22 import ast
23 import sys 23 import sys
24 24
25 from PyQt4.QtCore import QT_TRANSLATE_NOOP, QCoreApplication 25 from PyQt4.QtCore import QT_TRANSLATE_NOOP, QCoreApplication
26
27 PyCF_ONLY_AST = 1024
28 26
29 27
30 class DocStyleContext(object): 28 class DocStyleContext(object):
31 """ 29 """
32 Class implementing the source context. 30 Class implementing the source context.
468 if not self.__checkers: 466 if not self.__checkers:
469 # don't do anything, if no codes were selected 467 # don't do anything, if no codes were selected
470 return 468 return
471 469
472 try: 470 try:
473 compile(''.join(self.__source), '', 'exec', PyCF_ONLY_AST) 471 compile(''.join(self.__source), '', 'exec', ast.PyCF_ONLY_AST)
474 except (SyntaxError, TypeError): 472 except (SyntaxError, TypeError):
475 self.__reportInvalidSyntax() 473 self.__reportInvalidSyntax()
476 return 474 return
477 475
478 for keyword in self.__keywords: 476 for keyword in self.__keywords:

eric ide

mercurial