UtilitiesPython2/pep8.py

branch
5_1_x
changeset 1146
8ddb232355b9
parent 842
984b5535cd26
child 1510
e75ecf2bd9dd
equal deleted inserted replaced
1141:3017c0a73c73 1146:8ddb232355b9
254 line = physical_line.rstrip() 254 line = physical_line.rstrip()
255 length = len(line) 255 length = len(line)
256 if length > MAX_LINE_LENGTH: 256 if length > MAX_LINE_LENGTH:
257 try: 257 try:
258 # The line could contain multi-byte characters 258 # The line could contain multi-byte characters
259 if not hasattr(line, 'decode'): # Python 3 259 if hasattr(line, 'decode'): # Python 2 only
260 line = line.encode('latin-1') 260 length = len(line.decode('utf-8'))
261 length = len(line.decode('utf-8'))
262 except UnicodeDecodeError: 261 except UnicodeDecodeError:
263 pass 262 pass
264 if length > MAX_LINE_LENGTH: 263 if length > MAX_LINE_LENGTH:
265 return MAX_LINE_LENGTH, "E501", length 264 return MAX_LINE_LENGTH, "E501", length
266 265

eric ide

mercurial