Kaydet (Commit) 1835563a authored tarafından Sergey Fedoseev's avatar Sergey Fedoseev Kaydeden (comit) Tim Graham

Removed unneeded list() calls in sorted() argument.

üst a98bcfb0
...@@ -98,8 +98,8 @@ def iter_all_python_module_files(): ...@@ -98,8 +98,8 @@ def iter_all_python_module_files():
# modules based on the module name and pass it to iter_modules_and_files(). # modules based on the module name and pass it to iter_modules_and_files().
# This ensures cached results are returned in the usual case that modules # This ensures cached results are returned in the usual case that modules
# aren't loaded on the fly. # aren't loaded on the fly.
modules_view = sorted(list(sys.modules.items()), key=lambda i: i[0]) keys = sorted(sys.modules)
modules = tuple(m[1] for m in modules_view if not isinstance(m[1], weakref.ProxyTypes)) modules = tuple(m for m in map(sys.modules.__getitem__, keys) if not isinstance(m, weakref.ProxyTypes))
return iter_modules_and_files(modules, frozenset(_error_files)) return iter_modules_and_files(modules, frozenset(_error_files))
......
...@@ -168,7 +168,7 @@ class CaseInsensitiveMappingTests(SimpleTestCase): ...@@ -168,7 +168,7 @@ class CaseInsensitiveMappingTests(SimpleTestCase):
CaseInsensitiveMapping([(1, '2')]) CaseInsensitiveMapping([(1, '2')])
def test_list(self): def test_list(self):
self.assertEqual(sorted(list(self.dict1)), sorted(['Accept', 'content-type'])) self.assertEqual(list(self.dict1), ['Accept', 'content-type'])
def test_dict(self): def test_dict(self):
self.assertEqual(dict(self.dict1), {'Accept': 'application/json', 'content-type': 'text/html'}) self.assertEqual(dict(self.dict1), {'Accept': 'application/json', 'content-type': 'text/html'})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment