wrap py3 iterators with list() for each places that expect a list object. refs #1350.

This commit is contained in:
Takayuki Shimizukawa committed 2014-04-30 23:25:44 +09:00
1 parent 6ae3b68859
commit 2d1549b35a
21 files changed
+35 -37

No files matched your search

+5 -5
View File
@@ -350,7 +350,7 @@ class coverage:
'-o:': 'omit=',
}
short_opts = string.join(map(lambda o: o[1:], optmap.keys()), '')
long_opts = optmap.values()
long_opts = list(optmap.values())
options, args = getopt.getopt(argv, short_opts, long_opts)
for o, a in options:
if o in optmap:
@@ -401,7 +401,7 @@ class coverage:
if settings.get('collect'):
self.collect()
if not args:
args = self.cexecuted.keys()
args = list(self.cexecuted.keys())
ignore_errors = settings.get('ignore-errors')
show_missing = settings.get('show-missing')
@@ -743,9 +743,9 @@ class coverage:
visitor = StatementFindingAstVisitor(statements, excluded, suite_spots)
compiler.walk(ast, visitor, walker=visitor)
lines = statements.keys()
lines = list(statements.keys())
lines.sort()
excluded_lines = excluded.keys()
excluded_lines = list(excluded.keys())
excluded_lines.sort()
return lines, excluded_lines, suite_spots
@@ -850,7 +850,7 @@ class coverage:
morfs = self.filter_by_prefix(morfs, omit_prefixes)
morfs.sort(self.morf_name_compare)
max_name = max([5,] + map(len, map(self.morf_name, morfs)))
max_name = max([5,] + list(map(len, map(self.morf_name, morfs))))
fmt_name = "%%- %ds " % max_name
fmt_err = fmt_name + "%s: %s"
header = fmt_name % "Name" + " Stmts Exec Cover"
+4 -4
View File
@@ -864,7 +864,7 @@ def _serialize_xml(write, elem, encoding, qnames, namespaces):
_serialize_xml(write, e, encoding, qnames, None)
else:
write("<" + tag)
items = elem.items()
items = list(elem.items())
if items or namespaces:
items.sort() # lexical order
for k, v in items:
@@ -876,7 +876,7 @@ def _serialize_xml(write, elem, encoding, qnames, namespaces):
v = _escape_attrib(v, encoding)
write(" %s=\"%s\"" % (qnames[k], v))
if namespaces:
items = namespaces.items()
items = list(namespaces.items())
items.sort(key=lambda x: x[1]) # sort on prefix
for v, k in items:
if k:
@@ -921,7 +921,7 @@ def _serialize_html(write, elem, encoding, qnames, namespaces):
_serialize_html(write, e, encoding, qnames, None)
else:
write("<" + tag)
items = elem.items()
items = list(elem.items())
if items or namespaces:
items.sort() # lexical order
for k, v in items:
@@ -934,7 +934,7 @@ def _serialize_html(write, elem, encoding, qnames, namespaces):
# FIXME: handle boolean attributes
write(" %s=\"%s\"" % (qnames[k], v))
if namespaces:
items = namespaces.items()
items = list(namespaces.items())
items.sort(key=lambda x: x[1]) # sort on prefix
for v, k in items:
if k:
+1 -1
View File
@@ -190,7 +190,7 @@ class path(text_type):
"""
Joins the path with the argument given and returns the result.
"""
return self.__class__(os.path.join(self, *map(self.__class__, args)))
return self.__class__(os.path.join(self, *list(map(self.__class__, args))))
__div__ = __truediv__ = joinpath
+1 -1
View File
@@ -35,7 +35,7 @@ def test_mangle_signature():
(a=1, b=<SomeClass: a, b, c>, c=3) :: ([a, b, c])
"""
TEST = [map(lambda x: x.strip(), x.split("::")) for x in TEST.split("\n")
TEST = [[y.strip() for y in x.split("::")] for x in TEST.split("\n")
if '::' in x]
for inp, outp in TEST:
res = mangle_signature(inp).strip().replace(u"\u00a0", " ")
+1 -1
View File
@@ -98,7 +98,7 @@ def assert_elem(elem, texts=None, refs=None, names=None):
_texts = elem_gettexts(elem)
assert _texts == texts
if refs is not None:
_refs = map(elem_getref, elem.findall('reference'))
_refs = [elem_getref(x) for x in elem.findall('reference')]
assert _refs == refs
if names is not None:
_names = elem.attrib.get('names').split()