[fix] pep8

This commit is contained in:
Adam Tauber 2020-07-08 00:46:03 +02:00
parent 9f5cd28dba
commit 52eba0c721
2 changed files with 43 additions and 36 deletions

View File

@ -131,6 +131,7 @@ suggestion_xpath = '//div[contains(@class, "card-section")]//a'
# *spelling suggestions*, we use them anyway.
spelling_suggestion_xpath = '//div[@class="med"]/p/a'
def extract_text_from_dom(result, xpath):
"""returns extract_text on the first result selected by the xpath or None"""
r = eval_xpath(result, xpath)
@ -138,6 +139,7 @@ def extract_text_from_dom(result, xpath):
return extract_text(r[0])
return None
def get_lang_country(params, lang_list, custom_aliases):
"""Returns a tuple with *langauage* on its first and *country* on its second
position."""
@ -159,6 +161,7 @@ def get_lang_country(params, lang_list, custom_aliases):
return language, country, lang_country
def request(query, params):
"""Google search request"""
@ -200,6 +203,7 @@ def request(query, params):
return params
def response(resp):
"""Get response from google's search request"""
results = []
@ -272,6 +276,7 @@ def response(resp):
# return results
return results
# get supported languages from their site
def _fetch_supported_languages(resp):
ret_val = {}

View File

@ -33,15 +33,15 @@ from searx.engines.xpath import extract_text
# pylint: disable=unused-import
from searx.engines.google import (
supported_languages_url
, _fetch_supported_languages
supported_languages_url,
_fetch_supported_languages,
)
# pylint: enable=unused-import
from searx.engines.google import (
get_lang_country
, google_domains
, time_range_dict
get_lang_country,
google_domains,
time_range_dict,
)
logger = logger.getChild('google images')
@ -61,6 +61,7 @@ filter_mapping = {
2: 'active'
}
def scrap_out_thumbs(dom):
"""Scrap out thumbnail data from <script> tags.
"""
@ -75,6 +76,7 @@ def scrap_out_thumbs(dom):
ret_val[_thumb_no] = _img_data.replace(r"\x3d", "=")
return ret_val
def request(query, params):
"""Google-Video search request"""