提交 87dc65ea 编辑于 作者: Tarek Ziade's avatar Tarek Ziade
浏览文件

cleanup

显示 3 个添加1 个删除
+3 -1
......@@ -177,7 +177,7 @@ def get_code_complexity(code, min=7, filename='stdin'):
try:
ast = compiler.parse(code)
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
visitor = PathGraphingAstVisitor()
......
......@@ -721,12 +721,14 @@ def python_3000_backticks(logical_line):
if '' == ''.encode():
# Python 2: implicit encoding.
def readlines(filename):
return open(filename).readlines()
else:
# Python 3: decode to latin-1.
# This function is lazy, it does not read the encoding declaration.
# XXX: use tokenize.detect_encoding()
def readlines(filename): # NOQA
return open(filename, encoding='latin-1').readlines()
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册