From 4026523a2eeb1d40e2c0eda14618b5894a38f1c5 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Tue, 13 Sep 2022 20:59:14 +0200 Subject: [PATCH] [REMOVED] Unnecessary `lambda` statement The `lambda` statement in `base.py` is unnecessary and has no effect. ```py ugettext = lambda s: s LANGUAGES = ( ("en", ugettext("English")), ("de", ugettext("German")), ("es", ugettext("Spanish")), ("zh-hans", ugettext("Chinese Simplified")), ("ru", ugettext("Russian")), ("ko", ugettext("Korean")), ("fr", ugettext("French")), ("ja", ugettext("Japanese")), ("it", ugettext("Italian")), ) ``` In this case `ugettext = lambda s: s` is pretty much the same as: ```py def ugettext(s): return s ``` And would simply return the string the function receives as parameter. So we can omit this completely and simplify the `LANGUAGES` list to: ```py LANGUAGES = ( ("en", "English"), ("de", "German"), ("es", "Spanish"), ("zh-hans", "Chinese Simplified"), ("ru", "Russian"), ("ko", "Korean"), ("fr", "French"), ("ja", "Japanese"), ("it", "Italian"), ) ``` --- .../project_name/settings/base.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/allianceauth/project_template/project_name/settings/base.py b/allianceauth/project_template/project_name/settings/base.py index 80edcdc9..90f1ff18 100644 --- a/allianceauth/project_template/project_name/settings/base.py +++ b/allianceauth/project_template/project_name/settings/base.py @@ -84,17 +84,16 @@ LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale/'), ) -ugettext = lambda s: s LANGUAGES = ( - ('en', ugettext('English')), - ('de', ugettext('German')), - ('es', ugettext('Spanish')), - ('zh-hans', ugettext('Chinese Simplified')), - ('ru', ugettext('Russian')), - ('ko', ugettext('Korean')), - ('fr', ugettext('French')), - ('ja', ugettext('Japanese')), - ('it', ugettext('Italian')), + ("en", "English"), + ("de", "German"), + ("es", "Spanish"), + ("zh-hans", "Chinese Simplified"), + ("ru", "Russian"), + ("ko", "Korean"), + ("fr", "French"), + ("ja", "Japanese"), + ("it", "Italian"), ) TEMPLATES = [