Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Feb 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions django/utils/autoreload.py
Expand Up @@ -98,8 +98,8 @@ def iter_all_python_module_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
# aren't loaded on the fly.
modules_view = sorted(list(sys.modules.items()), key=lambda i: i[0])
modules = tuple(m[1] for m in modules_view if not isinstance(m[1], weakref.ProxyTypes))
keys = sorted(sys.modules)
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))


Expand Down
2 changes: 1 addition & 1 deletion tests/utils_tests/test_datastructures.py
Expand Up @@ -168,7 +168,7 @@ def test_create_with_invalid_key(self):
CaseInsensitiveMapping([(1, '2')])

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):
self.assertEqual(dict(self.dict1), {'Accept': 'application/json', 'content-type': 'text/html'})
Expand Down