mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 14:54:17 +00:00
cleanup
This commit is contained in:
parent
ff8a99cd62
commit
87dc65eac1
2 changed files with 3 additions and 1 deletions
|
|
@ -177,7 +177,7 @@ def get_code_complexity(code, min=7, filename='stdin'):
|
||||||
try:
|
try:
|
||||||
ast = compiler.parse(code)
|
ast = compiler.parse(code)
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
print >>sys.stderr, "Unable to parse %s: %s" % (filename, e)
|
print >> sys.stderr, "Unable to parse %s: %s" % (filename, e)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
visitor = PathGraphingAstVisitor()
|
visitor = PathGraphingAstVisitor()
|
||||||
|
|
|
||||||
|
|
@ -721,12 +721,14 @@ def python_3000_backticks(logical_line):
|
||||||
|
|
||||||
if '' == ''.encode():
|
if '' == ''.encode():
|
||||||
# Python 2: implicit encoding.
|
# Python 2: implicit encoding.
|
||||||
|
|
||||||
def readlines(filename):
|
def readlines(filename):
|
||||||
return open(filename).readlines()
|
return open(filename).readlines()
|
||||||
else:
|
else:
|
||||||
# Python 3: decode to latin-1.
|
# Python 3: decode to latin-1.
|
||||||
# This function is lazy, it does not read the encoding declaration.
|
# This function is lazy, it does not read the encoding declaration.
|
||||||
# XXX: use tokenize.detect_encoding()
|
# XXX: use tokenize.detect_encoding()
|
||||||
|
|
||||||
def readlines(filename): # NOQA
|
def readlines(filename): # NOQA
|
||||||
return open(filename, encoding='latin-1').readlines()
|
return open(filename, encoding='latin-1').readlines()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue