Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py

changeset 4510
43437fc9f4c9
parent 4509
7797ee4a45f9
child 4511
b5e4e7efa904
equal deleted inserted replaced
4509:7797ee4a45f9 4510:43437fc9f4c9
161 161
162 if not self.__checkers: 162 if not self.__checkers:
163 # don't do anything, if no codes were selected 163 # don't do anything, if no codes were selected
164 return 164 return
165 165
166 source = "".join(self.__source)
167 # Check type for py2: if not str it's unicode
168 if sys.version_info[0] == 2:
169 try:
170 source = source.encode('utf-8')
171 except UnicodeError:
172 pass
166 try: 173 try:
167 self.__tree = compile( 174 self.__tree = compile(source, self.__filename, 'exec',
168 ''.join(self.__source), '', 'exec', ast.PyCF_ONLY_AST) 175 ast.PyCF_ONLY_AST)
169 except (SyntaxError, TypeError): 176 except (SyntaxError, TypeError):
170 self.__reportInvalidSyntax() 177 self.__reportInvalidSyntax()
171 return 178 return
172 179
173 for check in self.__checkers: 180 for check in self.__checkers:

eric ide

mercurial