From fa0d05c3131041eb44542e0b505eaed1833bf86e Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 5 May 2021 16:47:02 +0200 Subject: [PATCH] [pylint] checker/__main__.py & checker/background.py Lint files that has been touched by [PR #58] [PR #58] https://github.com/searxng/searxng/pull/58 Signed-off-by: Markus Heiser --- searx/search/checker/__main__.py | 2 ++ searx/search/checker/background.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/searx/search/checker/__main__.py b/searx/search/checker/__main__.py index 7f6de8f8b..7a85347cc 100644 --- a/searx/search/checker/__main__.py +++ b/searx/search/checker/__main__.py @@ -1,4 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later +# lint: pylint +# pylint: disable=missing-module-docstring, missing-function-docstring import sys import io diff --git a/searx/search/checker/background.py b/searx/search/checker/background.py index 276426fa7..4c2750b44 100644 --- a/searx/search/checker/background.py +++ b/searx/search/checker/background.py @@ -1,4 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later +# lint: pylint +# pylint: disable=missing-module-docstring, missing-function-docstring import json import random @@ -34,7 +36,7 @@ def _get_every(): return _get_interval(every, 'checker.scheduling.every is not a int or list') -def get_result(): +def get_result(): # pylint: disable=inconsistent-return-statements serialized_result = storage.get_str(CHECKER_RESULT) if serialized_result is not None: return json.loads(serialized_result) @@ -47,7 +49,7 @@ def _set_result(result, include_timestamp=True): def run(): - if not running.acquire(blocking=False): + if not running.acquire(blocking=False): # pylint: disable=consider-using-with return try: logger.info('Starting checker') @@ -66,7 +68,7 @@ def run(): _set_result(result) logger.info('Check done') - except Exception: + except Exception: # pylint: disable=broad-except _set_result({'status': 'error'}) logger.exception('Error while running the checker') finally: @@ -87,7 +89,7 @@ def _start_scheduling(): run() -def _signal_handler(signum, frame): +def _signal_handler(_signum, _frame): t = threading.Thread(target=run) t.daemon = True t.start()