fixed flake8 tests (python2 vs -3)
This commit is contained in:
parent
22b51ebf33
commit
baef9f0cb7
16
speedtest.py
16
speedtest.py
|
@ -217,12 +217,12 @@ else:
|
||||||
return
|
return
|
||||||
|
|
||||||
def write(data):
|
def write(data):
|
||||||
if not isinstance(data, basestring):
|
if not isinstance(data, basestring): # noqa
|
||||||
data = str(data)
|
data = str(data)
|
||||||
# If the file has an encoding, encode unicode with it.
|
# If the file has an encoding, encode unicode with it.
|
||||||
encoding = 'utf8' # Always trust UTF-8 for output
|
encoding = 'utf8' # Always trust UTF-8 for output
|
||||||
if (isinstance(fp, file) and
|
if (isinstance(fp, file) and # noqa
|
||||||
isinstance(data, unicode) and
|
isinstance(data, unicode) and # noqa
|
||||||
encoding is not None):
|
encoding is not None):
|
||||||
errors = getattr(fp, "errors", None)
|
errors = getattr(fp, "errors", None)
|
||||||
if errors is None:
|
if errors is None:
|
||||||
|
@ -233,13 +233,13 @@ else:
|
||||||
want_unicode = False
|
want_unicode = False
|
||||||
sep = kwargs.pop("sep", None)
|
sep = kwargs.pop("sep", None)
|
||||||
if sep is not None:
|
if sep is not None:
|
||||||
if isinstance(sep, unicode):
|
if isinstance(sep, unicode): # noqa
|
||||||
want_unicode = True
|
want_unicode = True
|
||||||
elif not isinstance(sep, str):
|
elif not isinstance(sep, str):
|
||||||
raise TypeError("sep must be None or a string")
|
raise TypeError("sep must be None or a string")
|
||||||
end = kwargs.pop("end", None)
|
end = kwargs.pop("end", None)
|
||||||
if end is not None:
|
if end is not None:
|
||||||
if isinstance(end, unicode):
|
if isinstance(end, unicode): # noqa
|
||||||
want_unicode = True
|
want_unicode = True
|
||||||
elif not isinstance(end, str):
|
elif not isinstance(end, str):
|
||||||
raise TypeError("end must be None or a string")
|
raise TypeError("end must be None or a string")
|
||||||
|
@ -247,12 +247,12 @@ else:
|
||||||
raise TypeError("invalid keyword arguments to print()")
|
raise TypeError("invalid keyword arguments to print()")
|
||||||
if not want_unicode:
|
if not want_unicode:
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if isinstance(arg, unicode):
|
if isinstance(arg, unicode): # noqa
|
||||||
want_unicode = True
|
want_unicode = True
|
||||||
break
|
break
|
||||||
if want_unicode:
|
if want_unicode:
|
||||||
newline = unicode("\n")
|
newline = unicode("\n") # noqa
|
||||||
space = unicode(" ")
|
space = unicode(" ") # noqa
|
||||||
else:
|
else:
|
||||||
newline = "\n"
|
newline = "\n"
|
||||||
space = " "
|
space = " "
|
||||||
|
|
Loading…
Reference in New Issue