Merge pull request #74 from searxng/pylint-workaround

[fix] webapp.py: pylint: disable=assigning-non-slot for request.*
This commit is contained in:
Markus Heiser 2021-05-14 14:24:35 +00:00 committed by GitHub
commit d4ce13ddfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -483,7 +483,8 @@ def render(template_name, override_theme=None, **kwargs):
start_time = default_timer() start_time = default_timer()
result = render_template( result = render_template(
'{}/{}'.format(kwargs['theme'], template_name), **kwargs) '{}/{}'.format(kwargs['theme'], template_name), **kwargs)
request.render_time += default_timer() - start_time request.render_time += default_timer() - start_time # pylint: disable=assigning-non-slot
return result return result
@ -500,16 +501,16 @@ def _get_ordered_categories():
@app.before_request @app.before_request
def pre_request(): def pre_request():
request.start_time = default_timer() request.start_time = default_timer() # pylint: disable=assigning-non-slot
request.render_time = 0 request.render_time = 0 # pylint: disable=assigning-non-slot
request.timings = [] request.timings = [] # pylint: disable=assigning-non-slot
request.errors = [] request.errors = [] # pylint: disable=assigning-non-slot
preferences = Preferences(themes, list(categories.keys()), engines, plugins) preferences = Preferences(themes, list(categories.keys()), engines, plugins)
user_agent = request.headers.get('User-Agent', '').lower() user_agent = request.headers.get('User-Agent', '').lower()
if 'webkit' in user_agent and 'android' in user_agent: if 'webkit' in user_agent and 'android' in user_agent:
preferences.key_value_settings['method'].value = 'GET' preferences.key_value_settings['method'].value = 'GET'
request.preferences = preferences request.preferences = preferences # pylint: disable=assigning-non-slot
try: try:
preferences.parse_dict(request.cookies) preferences.parse_dict(request.cookies)
except: except:
@ -517,7 +518,7 @@ def pre_request():
# merge GET, POST vars # merge GET, POST vars
# request.form # request.form
request.form = dict(request.form.items()) request.form = dict(request.form.items()) # pylint: disable=assigning-non-slot
for k, v in request.args.items(): for k, v in request.args.items():
if k not in request.form: if k not in request.form:
request.form[k] = v request.form[k] = v
@ -538,7 +539,7 @@ def pre_request():
preferences.parse_dict({"locale": get_locale()}) preferences.parse_dict({"locale": get_locale()})
# request.user_plugins # request.user_plugins
request.user_plugins = [] request.user_plugins = [] # pylint: disable=assigning-non-slot
allowed_plugins = preferences.plugins.get_enabled() allowed_plugins = preferences.plugins.get_enabled()
disabled_plugins = preferences.plugins.get_disabled() disabled_plugins = preferences.plugins.get_disabled()
for plugin in plugins: for plugin in plugins:
@ -673,7 +674,7 @@ def search():
return redirect(result_container.redirect_url) return redirect(result_container.redirect_url)
# Server-Timing header # Server-Timing header
request.timings = result_container.get_timings() request.timings = result_container.get_timings() # pylint: disable=assigning-non-slot
# output # output
for result in results: for result in results: