|
@@ -6,7 +6,6 @@ import inspect
|
|
import magic
|
|
import magic
|
|
import os
|
|
import os
|
|
import re
|
|
import re
|
|
-import six
|
|
|
|
import sys
|
|
import sys
|
|
|
|
|
|
import checkpackagelib.base
|
|
import checkpackagelib.base
|
|
@@ -228,12 +227,9 @@ def check_file_using_lib(fname):
|
|
if fail > 0:
|
|
if fail > 0:
|
|
failed.add(name)
|
|
failed.add(name)
|
|
nwarnings += warn
|
|
nwarnings += warn
|
|
- if six.PY3:
|
|
|
|
- f = open(fname, "r", errors="surrogateescape")
|
|
|
|
- else:
|
|
|
|
- f = open(fname, "r")
|
|
|
|
|
|
+
|
|
lastline = ""
|
|
lastline = ""
|
|
- for lineno, text in enumerate(f.readlines()):
|
|
|
|
|
|
+ for lineno, text in enumerate(open(fname, "r", errors="surrogateescape").readlines()):
|
|
nlines += 1
|
|
nlines += 1
|
|
for name, cf in objects:
|
|
for name, cf in objects:
|
|
if cf.disable.search(lastline):
|
|
if cf.disable.search(lastline):
|
|
@@ -243,7 +239,7 @@ def check_file_using_lib(fname):
|
|
failed.add(name)
|
|
failed.add(name)
|
|
nwarnings += warn
|
|
nwarnings += warn
|
|
lastline = text
|
|
lastline = text
|
|
- f.close()
|
|
|
|
|
|
+
|
|
for name, cf in objects:
|
|
for name, cf in objects:
|
|
warn, fail = print_warnings(cf.after(), name in xfail)
|
|
warn, fail = print_warnings(cf.after(), name in xfail)
|
|
if fail > 0:
|
|
if fail > 0:
|