Refs #32355 -- Removed unnecessary list() calls before reversed() on dictviews.

Dict and dictviews are iterable in reversed insertion order using
reversed() in Python 3.8+.
This commit is contained in:
Mariusz Felisiak 2022-01-07 16:29:15 +01:00 committed by GitHub
parent 4c60c3edff
commit 7346c288e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ def get_commands():
if not settings.configured: if not settings.configured:
return commands return commands
for app_config in reversed(list(apps.get_app_configs())): for app_config in reversed(apps.get_app_configs()):
path = os.path.join(app_config.path, 'management') path = os.path.join(app_config.path, 'management')
commands.update({name: app_config.name for name in find_commands(path)}) commands.update({name: app_config.name for name in find_commands(path)})

View File

@ -191,7 +191,7 @@ class DjangoTranslation(gettext_module.GNUTranslations):
def _add_installed_apps_translations(self): def _add_installed_apps_translations(self):
"""Merge translations from each installed app.""" """Merge translations from each installed app."""
try: try:
app_configs = reversed(list(apps.get_app_configs())) app_configs = reversed(apps.get_app_configs())
except AppRegistryNotReady: except AppRegistryNotReady:
raise AppRegistryNotReady( raise AppRegistryNotReady(
"The translation infrastructure cannot be initialized before the " "The translation infrastructure cannot be initialized before the "