UtilitiesPython2/Py2SyntaxChecker.py

changeset 2409
df3820f08247
parent 2302
f29e9405c851
child 2998
95581102e03e
equal deleted inserted replaced
2408:dc3a7c9d8f6e 2409:df3820f08247
11 import sys 11 import sys
12 import re 12 import re
13 import traceback 13 import traceback
14 14
15 from Tools import readEncodedFile, normalizeCode, extractLineFlags 15 from Tools import readEncodedFile, normalizeCode, extractLineFlags
16
17 from py2flakes.checker import Checker
18 from py2flakes.messages import ImportStarUsed
19 16
20 17
21 def compile(file, codestring): 18 def compile(file, codestring):
22 """ 19 """
23 Function to compile one Python source file to Python bytecode. 20 Function to compile one Python source file to Python bytecode.
102 @param ignoreStarImportWarnings flag indicating to 99 @param ignoreStarImportWarnings flag indicating to
103 ignore 'star import' warnings (boolean) 100 ignore 'star import' warnings (boolean)
104 @return list of strings containing the warnings 101 @return list of strings containing the warnings
105 (marker, file name, line number, message) 102 (marker, file name, line number, message)
106 """ 103 """
104 from py2flakes.checker import Checker
105 from py2flakes.messages import ImportStarUsed
106
107 strings = [] 107 strings = []
108 lines = codestring.splitlines() 108 lines = codestring.splitlines()
109 try: 109 try:
110 warnings = Checker(codestring, fileName) 110 warnings = Checker(codestring, fileName)
111 warnings.messages.sort(key=lambda a: a.lineno) 111 warnings.messages.sort(key=lambda a: a.lineno)

eric ide

mercurial