Skip to content

@florentx /pep8org.py
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#!python
import re
import pep8
# This is a very long line - 79 chars --------------------------------123456789
# This is a very [[with-poporg][long line]] - 79 chars --------------------------------123456789
# This is a very [[with-poporg][long line]] - 80 chars --------------------------------1234567890
def maximum_line_length(physical_line, max_line_length):
line = physical_line.rstrip()
length = len(line)
if length > max_line_length:
if pep8.noqa(line):
return
if hasattr(line, 'decode'): # Python 2
# The line could contain multi-byte characters
try:
length = len(line.decode('utf-8'))
except UnicodeError:
pass
if length > max_line_length:
line = re.sub(r'\[\[[^]]*\]\[([^]]*)\]\]', r'\1', line)
length = len(line)
if length > max_line_length:
return (max_line_length, "E501 line too long "
"(%d > %d characters)" % (length, max_line_length))
del pep8._checks['physical_line'][pep8.maximum_line_length]
pep8.register_check(maximum_line_length, ['E501'])
if __name__ == '__main__':
pep8._main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.