Plugins/CheckerPlugins/Pep8/pep8.py

changeset 1145
2a16484e65c2
parent 945
8cd4d08fa9f6
child 1509
c0b5e693b0eb
equal deleted inserted replaced
1144:6185688709ff 1145:2a16484e65c2
365 line = physical_line.rstrip() 365 line = physical_line.rstrip()
366 length = len(line) 366 length = len(line)
367 if length > MAX_LINE_LENGTH: 367 if length > MAX_LINE_LENGTH:
368 try: 368 try:
369 # The line could contain multi-byte characters 369 # The line could contain multi-byte characters
370 if not hasattr(line, 'decode'): # Python 3 370 if hasattr(line, 'decode'): # Python 2 only
371 line = line.encode('latin-1') 371 length = len(line.decode('utf-8'))
372 length = len(line.decode('utf-8'))
373 except UnicodeDecodeError: 372 except UnicodeDecodeError:
374 pass 373 pass
375 if length > MAX_LINE_LENGTH: 374 if length > MAX_LINE_LENGTH:
376 return MAX_LINE_LENGTH, "E501", length 375 return MAX_LINE_LENGTH, "E501", length
377 376

eric ide

mercurial