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

View file

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