eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

changeset 7637
c878e8255972
parent 7635
0cdead130a81
child 7639
422fd05e9c91
equal deleted inserted replaced
7636:61566f35ab22 7637:c878e8255972
5 5
6 """ 6 """
7 Module implementing the code style checker. 7 Module implementing the code style checker.
8 """ 8 """
9 9
10 try: # Only for Py2 10 import queue
11 import Queue as queue
12 except ImportError:
13 import queue
14
15 import ast 11 import ast
16 import sys 12 import sys
17 import multiprocessing 13 import multiprocessing
18 14
19 import pycodestyle 15 import pycodestyle
284 @return tuple containing the error dictionary with syntax error details 280 @return tuple containing the error dictionary with syntax error details
285 and a statistics dictionary or a tuple containing two None 281 and a statistics dictionary or a tuple containing two None
286 @rtype tuple of (dict, dict) or tuple of (None, None) 282 @rtype tuple of (dict, dict) or tuple of (None, None)
287 """ 283 """
288 src = "".join(source) 284 src = "".join(source)
289 # Check type for py2: if not str it's unicode
290 if sys.version_info[0] == 2:
291 try:
292 src = src.encode('utf-8')
293 except UnicodeError:
294 pass
295 285
296 try: 286 try:
297 ast.parse(src, filename, 'exec') 287 ast.parse(src, filename, 'exec')
298 return None, None 288 return None, None
299 except (SyntaxError, TypeError): 289 except (SyntaxError, TypeError):

eric ide

mercurial