From 24f2376c1185dbc0a31ca7d8a777225cf7bea39a Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 3 Jul 2021 17:51:39 +0200 Subject: [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 --- searx/search/checker/__main__.py | 12 ++++++++++-- searx/search/processors/__init__.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'searx/search') diff --git a/searx/search/checker/__main__.py b/searx/search/checker/__main__.py index 7a85347cc..e1de860b7 100644 --- a/searx/search/checker/__main__.py +++ b/searx/search/checker/__main__.py @@ -34,8 +34,16 @@ else: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = "", "", "", "", "", "", "", "" # equivalent of 'python -u' (unbuffered stdout, stderr) -stdout = io.TextIOWrapper(open(sys.stdout.fileno(), 'wb', 0), write_through=True) -stderr = io.TextIOWrapper(open(sys.stderr.fileno(), 'wb', 0), write_through=True) +stdout = io.TextIOWrapper( + # pylint: disable=consider-using-with + open(sys.stdout.fileno(), 'wb', 0), + write_through=True +) +stderr = io.TextIOWrapper( + # pylint: disable=consider-using-with + open(sys.stderr.fileno(), 'wb', 0) + , write_through=True +) # iterator of processors diff --git a/searx/search/processors/__init__.py b/searx/search/processors/__init__.py index d5ebdb70c..b3d121f0e 100644 --- a/searx/search/processors/__init__.py +++ b/searx/search/processors/__init__.py @@ -17,7 +17,7 @@ __all__ = [ import threading from searx import logger -import searx.engines as engines +from searx import engines from .online import OnlineProcessor from .offline import OfflineProcessor -- cgit v1.2.3