24 from pyflakes.checker import Checker |
24 from pyflakes.checker import Checker |
25 from pyflakes.messages import ImportStarUsed, ImportStarUsage |
25 from pyflakes.messages import ImportStarUsed, ImportStarUsage |
26 except ImportError: |
26 except ImportError: |
27 pass |
27 pass |
28 |
28 |
29 VcsConflictMarkerRe = re.compile( |
29 VcsConflictMarkerRegExpList = ( |
30 r"""^<<<<<<< .*?=======.*?>>>>>>> .*?$""", |
30 re.compile( |
31 re.MULTILINE | re.DOTALL) |
31 r"""^<<<<<<< .*?=======.*?>>>>>>> .*?$""", |
32 |
32 re.MULTILINE | re.DOTALL |
|
33 ), |
|
34 re.compile( |
|
35 r"""^<<<<<<< .*?||||||| .?=======.*?>>>>>>> .*?$""", |
|
36 re.MULTILINE | re.DOTALL |
|
37 ) |
|
38 ) |
33 |
39 |
34 def initService(): |
40 def initService(): |
35 """ |
41 """ |
36 Initialize the service and return the entry point. |
42 Initialize the service and return the entry point. |
37 |
43 |
234 # It also encode the code back to avoid 'Encoding declaration in |
240 # It also encode the code back to avoid 'Encoding declaration in |
235 # unicode string' exception on Python2 |
241 # unicode string' exception on Python2 |
236 codestring = normalizeCode(codestring) |
242 codestring = normalizeCode(codestring) |
237 |
243 |
238 # Check for VCS conflict markers |
244 # Check for VCS conflict markers |
239 conflict = VcsConflictMarkerRe.search(codestring) |
245 for conflictMarkerRe in VcsConflictMarkerRegExpList: |
240 if conflict is not None: |
246 conflict = conflictMarkerRe.search(codestring) |
241 start, i = conflict.span() |
247 if conflict is not None: |
242 lineindex = 1 + codestring.count("\n", 0, start) |
248 start, i = conflict.span() |
243 return [{'error': |
249 lineindex = 1 + codestring.count("\n", 0, start) |
244 (file_enc, lineindex, 0, "", |
250 return [{'error': |
245 "VCS conflict marker found") |
251 (file_enc, lineindex, 0, "", |
246 }] |
252 "VCS conflict marker found") |
|
253 }] |
247 |
254 |
248 if filename.endswith('.ptl'): |
255 if filename.endswith('.ptl'): |
249 try: |
256 try: |
250 import quixote.ptl_compile |
257 import quixote.ptl_compile |
251 except ImportError: |
258 except ImportError: |