Plugins/CheckerPlugins/Pep8/pep8.py

branch
5_1_x
changeset 1146
8ddb232355b9
parent 850
8b9f09e7d5d9
child 1510
e75ecf2bd9dd
equal deleted inserted replaced
1141:3017c0a73c73 1146:8ddb232355b9
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