py2to3 automatic conversion. Woot!

This commit is contained in:
Ryan Holmes
2017-06-12 16:12:45 -04:00
parent ad535ccc78
commit 828b18d0fd
147 changed files with 1017 additions and 783 deletions

View File

@@ -2,9 +2,9 @@
# Passes Python2.7's test suite and incorporates all the latest updates.
try:
from thread import get_ident as _get_ident
from _thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident as _get_ident
from _dummy_thread import get_ident as _get_ident
try:
from _abcoll import KeysView, ValuesView, ItemsView
@@ -79,7 +79,7 @@ class OrderedDict(dict):
def clear(self):
"""od.clear() -> None. Remove all items from od."""
try:
for node in self.__map.itervalues():
for node in self.__map.values():
del node[:]
root = self.__root
root[:] = [root, root, None]
@@ -162,12 +162,12 @@ class OrderedDict(dict):
for key in other:
self[key] = other[key]
elif hasattr(other, 'keys'):
for key in other.keys():
for key in list(other.keys()):
self[key] = other[key]
else:
for key, value in other:
self[key] = value
for key, value in kwds.items():
for key, value in list(kwds.items()):
self[key] = value
__update = update # let subclasses override update without breaking __init__
@@ -205,7 +205,7 @@ class OrderedDict(dict):
try:
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())
return '%s(%r)' % (self.__class__.__name__, list(self.items()))
finally:
del _repr_running[call_key]
@@ -240,7 +240,7 @@ class OrderedDict(dict):
"""
if isinstance(other, OrderedDict):
return len(self) == len(other) and self.items() == other.items()
return len(self) == len(other) and list(self.items()) == list(other.items())
return dict.__eq__(self, other)
def __ne__(self, other):

View File

@@ -82,9 +82,9 @@ m_re_sub(stpw, 1000, 100000, "asdfadsasdaasdfadsasda")
def checkpoint(self, name=''):
span = self.elapsed
self.__update_stat(span)
text = u'Stopwatch("{tname}") - {checkpoint} - {last:.6f}ms ({elapsed:.12f}ms elapsed)'.format(
text = 'Stopwatch("{tname}") - {checkpoint} - {last:.6f}ms ({elapsed:.12f}ms elapsed)'.format(
tname=self.name,
checkpoint=unicode(name, "utf-8"),
checkpoint=str(name, "utf-8"),
last=self.last,
elapsed=span
).strip()

View File

@@ -12,7 +12,7 @@ def sequential_rep(text_, *args):
:return: if text_ length was zero or invalid parameters then no manipulation to text_
"""
arg_len = len(args)
if arg_len % 2 == 0 and isinstance(text_, basestring) and len(text_) > 0:
if arg_len % 2 == 0 and isinstance(text_, str) and len(text_) > 0:
i = 0
while i < arg_len:
text_ = re.sub(args[i], args[i + 1], text_)
@@ -27,4 +27,4 @@ def replace_ltgt(text_):
:param text_: string content of fit name from exported by EVE client.
:return: if text_ is not instance of basestring then no manipulation to text_.
"""
return text_.replace("&lt;", "<").replace("&gt;", ">") if isinstance(text_, basestring) else text_
return text_.replace("&lt;", "<").replace("&gt;", ">") if isinstance(text_, str) else text_

View File

@@ -17,9 +17,9 @@ class Timer(object):
return (time.time() - self.__last) * 1000
def checkpoint(self, name=''):
text = u'Timer - {timer} - {checkpoint} - {last:.2f}ms ({elapsed:.2f}ms elapsed)'.format(
text = 'Timer - {timer} - {checkpoint} - {last:.2f}ms ({elapsed:.2f}ms elapsed)'.format(
timer=self.name,
checkpoint=unicode(name, "utf-8"),
checkpoint=str(name, "utf-8"),
last=self.last,
elapsed=self.elapsed
).strip()