on master help sign in
[mod] pylint: minor code change to allow pylint globally

This commit is only a step, it doesn't fix all the issues reported by pylint

commit58d72f26925d56e22330c54be03c3dcbee0c4135 authorAlexandre Flament <alex@al-f.net> dateTue 3 Nov 2020, 11:35 (6 years ago) parentd7f2148
3 files changed+8−10
searx/engines/qwant.py+1−1 searx/engines/xpath.py+1 searx/webapp.py+6−9
searx/engines/qwant.py+1−1
@@ -17,7 +17,7 @@ from searx.utils import html_to_text, match_language
1717
1818
1919# engine dependent config
20−categories = None
20+categories = []
2121paging = True
2222language_support = True
2323supported_languages_url = 'https://qwant.com/region'
searx/engines/xpath.py+1
@@ -7,6 +7,7 @@ url_xpath = None
77content_xpath = None
88title_xpath = None
99thumbnail_xpath = False
10+categories = []
1011paging = False
1112suggestion_xpath = ''
1213results_xpath = ''
searx/webapp.py+6−9
@@ -44,7 +44,7 @@ from urllib.parse import urlencode, urlparse, urljoin, urlsplit
4444
4545from pygments import highlight
4646from pygments.lexers import get_lexer_by_name
47−from pygments.formatters import HtmlFormatter
47+from pygments.formatters import HtmlFormatter # pylint: disable=no-name-in-module
4848
4949from werkzeug.middleware.proxy_fix import ProxyFix
5050from flask import (
@@ -111,7 +111,7 @@ app = Flask(
111111
112112app.jinja_env.trim_blocks = True
113113app.jinja_env.lstrip_blocks = True
114−app.jinja_env.add_extension('jinja2.ext.loopcontrols')
114+app.jinja_env.add_extension('jinja2.ext.loopcontrols') # pylint: disable=no-member
115115app.secret_key = settings['server']['secret_key']
116116
117117# see https://flask.palletsprojects.com/en/1.1.x/cli/
@@ -565,15 +565,12 @@ def index():
565565
566566 result_container = search.search()
567567
568+ except SearxParameterException as e:
569+ logger.exception('search error: SearxParameterException')
570+ return index_error(output_format, e.message), 400
568571 except Exception as e:
569− # log exception
570572 logger.exception('search error')
571−
572− # is it an invalid input parameter or something else ?
573− if (issubclass(e.__class__, SearxParameterException)):
574− return index_error(output_format, e.message), 400
575− else:
576− return index_error(output_format, gettext('search error')), 500
573+ return index_error(output_format, gettext('search error')), 500
577574
578575 # results
579576 results = result_container.get_ordered_results()