summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorDalf <alex@al-f.net>2020-08-12 09:42:27 +0200
committerAlexandre Flament <alex@al-f.net>2020-09-10 10:39:04 +0200
commit78883777438fc07833d983c50d9b131eb6feb9eb (patch)
treefec44995d58a5c8ebe33ccd4406eaa228a55cbb3 /searx
parent78df10fb55d9632ccae71d9f3b9260c7614a421c (diff)
downloadsearxng-78883777438fc07833d983c50d9b131eb6feb9eb.tar.gz
searxng-78883777438fc07833d983c50d9b131eb6feb9eb.zip
Drop Python 2 (3/n): objects
Diffstat (limited to 'searx')
-rw-r--r--searx/exceptions.py2
-rw-r--r--searx/poolrequests.py6
-rw-r--r--searx/preferences.py4
-rw-r--r--searx/query.py4
-rw-r--r--searx/results.py4
-rw-r--r--searx/search.py8
-rwxr-xr-xsearx/webapp.py2
7 files changed, 15 insertions, 15 deletions
diff --git a/searx/exceptions.py b/searx/exceptions.py
index 0175acfa3..4af816272 100644
--- a/searx/exceptions.py
+++ b/searx/exceptions.py
@@ -27,7 +27,7 @@ class SearxParameterException(SearxException):
message = 'Empty ' + name + ' parameter'
else:
message = 'Invalid value "' + value + '" for parameter ' + name
- super(SearxParameterException, self).__init__(message)
+ super().__init__(message)
self.message = message
self.parameter_name = name
self.parameter_value = value
diff --git a/searx/poolrequests.py b/searx/poolrequests.py
index 9f0ee8736..51b6219c3 100644
--- a/searx/poolrequests.py
+++ b/searx/poolrequests.py
@@ -20,7 +20,7 @@ class HTTPAdapterWithConnParams(requests.adapters.HTTPAdapter):
self.config = {}
self.proxy_manager = {}
- super(requests.adapters.HTTPAdapter, self).__init__()
+ super().__init__()
self._pool_connections = pool_connections
self._pool_maxsize = pool_maxsize
@@ -60,7 +60,7 @@ else:
class SessionSinglePool(requests.Session):
def __init__(self):
- super(SessionSinglePool, self).__init__()
+ super().__init__()
# reuse the same adapters
with RLock():
@@ -71,7 +71,7 @@ class SessionSinglePool(requests.Session):
def close(self):
"""Call super, but clear adapters since there are managed globaly"""
self.adapters.clear()
- super(SessionSinglePool, self).close()
+ super().close()
def set_timeout_for_thread(timeout, start_time=None):
diff --git a/searx/preferences.py b/searx/preferences.py
index 04098be25..3042636a6 100644
--- a/searx/preferences.py
+++ b/searx/preferences.py
@@ -32,7 +32,7 @@ class ValidationException(Exception):
"""
-class Setting(object):
+class Setting:
"""Base class of user settings"""
def __init__(self, default_value, **kwargs):
@@ -310,7 +310,7 @@ class PluginsSetting(SwitchableSetting):
return [item[len('plugin_'):] for item in items]
-class Preferences(object):
+class Preferences:
"""Validates and saves preferences to cookies"""
def __init__(self, themes, categories, engines, plugins):
diff --git a/searx/query.py b/searx/query.py
index 69481f094..614e05c6b 100644
--- a/searx/query.py
+++ b/searx/query.py
@@ -28,7 +28,7 @@ from searx.engines import (
VALID_LANGUAGE_CODE = re.compile(r'^[a-z]{2,3}(-[a-zA-Z]{2})?$')
-class RawTextQuery(object):
+class RawTextQuery:
"""parse raw text query (the value from the html input)"""
def __init__(self, query, disabled_engines):
@@ -178,7 +178,7 @@ class RawTextQuery(object):
return ''.join(self.query_parts)
-class SearchQuery(object):
+class SearchQuery:
"""container for all the search parameters (query, language, etc...)"""
def __init__(self, query, engines, categories, lang, safesearch, pageno, time_range,
diff --git a/searx/results.py b/searx/results.py
index 51af32fd0..e4cad2e24 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -122,14 +122,14 @@ def result_score(result):
return sum((occurences * weight) / position for position in result['positions'])
-class ResultContainer(object):
+class ResultContainer:
"""docstring for ResultContainer"""
__slots__ = '_merged_results', 'infoboxes', 'suggestions', 'answers', 'corrections', '_number_of_results',\
'_ordered', 'paging', 'unresponsive_engines', 'timings', 'redirect_url'
def __init__(self):
- super(ResultContainer, self).__init__()
+ super().__init__()
self._merged_results = []
self.infoboxes = []
self.suggestions = set()
diff --git a/searx/search.py b/searx/search.py
index 0af004603..3695128ab 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -407,12 +407,12 @@ def get_search_query_from_webapp(preferences, form):
raw_text_query)
-class Search(object):
+class Search:
"""Search information container"""
def __init__(self, search_query):
# init vars
- super(Search, self).__init__()
+ super().__init__()
self.search_query = search_query
self.result_container = ResultContainer()
self.actual_timeout = None
@@ -534,13 +534,13 @@ class SearchWithPlugins(Search):
"""Similar to the Search class but call the plugins."""
def __init__(self, search_query, ordered_plugin_list, request):
- super(SearchWithPlugins, self).__init__(search_query)
+ super().__init__(search_query)
self.ordered_plugin_list = ordered_plugin_list
self.request = request
def search(self):
if plugins.call(self.ordered_plugin_list, 'pre_search', self.request, self):
- super(SearchWithPlugins, self).search()
+ super().search()
plugins.call(self.ordered_plugin_list, 'post_search', self.request, self)
diff --git a/searx/webapp.py b/searx/webapp.py
index ec2968259..25f43662a 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -1040,7 +1040,7 @@ def run():
)
-class ReverseProxyPathFix(object):
+class ReverseProxyPathFix:
'''Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is