summaryrefslogtreecommitdiff
path: root/searx/preferences.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-07-03 17:51:39 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2021-07-03 17:54:08 +0200
commit24f2376c1185dbc0a31ca7d8a777225cf7bea39a (patch)
treeac83826aaae73b55f444ed9d3c59b8ab5dd63f37 /searx/preferences.py
parent961dd287a11a2fbac9e11277b4bd5fdca0f4eaa7 (diff)
downloadsearxng-24f2376c1185dbc0a31ca7d8a777225cf7bea39a.tar.gz
searxng-24f2376c1185dbc0a31ca7d8a777225cf7bea39a.zip
[pylint] prepare for pylint v2.9.3 / fix some (new) pylint issues
Upgrade from pylint v2.8.3 to 2.9.3 raise some new issues:: searx/search/checker/__main__.py:37:26: R1732: Consider using 'with' for resource-allocating operations (consider-using-with) searx/search/checker/__main__.py:38:26: R1732: Consider using 'with' for resource-allocating operations (consider-using-with) searx/search/processors/__init__.py:20:0: R0402: Use 'from searx import engines' instead (consider-using-from-import) searx/preferences.py:182:19: C0207: Use data.split('-', maxsplit=1)[0] instead (use-maxsplit-arg) searx/preferences.py:506:15: R1733: Unnecessary dictionary index lookup, use 'user_setting' instead (unnecessary-dict-index-lookup) searx/webapp.py:436:0: C0206: Consider iterating with .items() (consider-using-dict-items) searx/webapp.py:950:4: C0206: Consider iterating with .items() (consider-using-dict-items) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/preferences.py')
-rw-r--r--searx/preferences.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/preferences.py b/searx/preferences.py
index b63bd446b..e4a2ebecd 100644
--- a/searx/preferences.py
+++ b/searx/preferences.py
@@ -179,7 +179,7 @@ class SearchLanguageSetting(EnumStringSetting):
if data not in self.choices and data != self.value: # pylint: disable=no-member
# hack to give some backwards compatibility with old language cookies
data = str(data).replace('_', '-')
- lang = data.split('-')[0]
+ lang = data.split('-', maxsplit=1)[0]
# pylint: disable=no-member
if data in self.choices:
pass
@@ -503,6 +503,7 @@ class Preferences:
"""Save cookie in the HTTP reponse obect
"""
for user_setting_name, user_setting in self.key_value_settings.items():
+ # pylint: disable=unnecessary-dict-index-lookup
if self.key_value_settings[user_setting_name].locked:
continue
user_setting.save(user_setting_name, resp)