on master help sign in
[fix] minor style fixes after picking open street map changes
commit53c4031f962b23bbaedce2498e0cf1c3f31a7bfe authorNoémi Ványi <sitbackandwait@gmail.com> dateSat 2 Oct 2021, 15:05 (5 years ago) parent42db733
2 files changed+9−6
searx/data/__init__.py+3 searx/engines/openstreetmap.py+6−6
searx/data/__init__.py+3
@@ -22,10 +22,12 @@ from pathlib import Path
2222
2323data_dir = Path(__file__).parent
2424
25+
2526def _load(filename):
2627 with open(data_dir / filename, encoding='utf-8') as f:
2728 return json.load(f)
2829
30+
2931def ahmia_blacklist_loader():
3032 """Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
3133 names. The MD5 values are fetched by::
@@ -38,6 +40,7 @@ def ahmia_blacklist_loader():
3840 with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f:
3941 return f.read().split()
4042
43+
4144ENGINES_LANGUAGES = _load('engines_languages.json')
4245CURRENCIES = _load('currencies.json')
4346USER_AGENTS = _load('useragents.json')
searx/engines/openstreetmap.py+6−6
@@ -37,7 +37,7 @@ search_string = 'search?{query}&polygon_geojson=1&format=jsonv2&addressdetails=1
3737result_id_url = 'https://openstreetmap.org/{osm_type}/{osm_id}'
3838result_lat_lon_url = 'https://www.openstreetmap.org/?mlat={lat}&mlon={lon}&zoom={zoom}&layers=M'
3939
40−route_url = 'https://graphhopper.com/maps/?point={}&point={}&locale=en-US&vehicle=car&weighting=fastest&turn_costs=true&use_miles=false&layer=Omniscale' # pylint: disable=line-too-long
40+route_url = 'https://graphhopper.com/maps/?point={}&point={}&locale=en-US&vehicle=car&weighting=fastest&turn_costs=true&use_miles=false&layer=Omniscale' # NOQA
4141route_re = re.compile('(?:from )?(.+) to (.+)')
4242
4343wikidata_image_sparql = """
@@ -60,7 +60,7 @@ where {
6060 }
6161}
6262ORDER by ?item
63−"""
63+""" # NOQA
6464
6565
6666# key value that are link: mapping functions
@@ -70,7 +70,7 @@ ORDER by ?item
7070def value_to_https_link(value):
7171 http = 'http://'
7272 if value.startswith(http):
73− value = 'https://' + value[len(http) :]
73+ value = 'https://' + value[len(http):]
7474 return (value, value)
7575
7676
@@ -154,7 +154,7 @@ def response(resp):
154154 results.append({
155155 'answer': gettext('Get directions'),
156156 'url': route_url.format(*resp.search_params['route'].groups()),
157− })
157+ })
158158
159159 fetch_wikidata(nominatim_json, user_language)
160160
@@ -269,9 +269,9 @@ def get_title_address(result):
269269 # https://github.com/osm-search/Nominatim/issues/1662
270270 address_name = address_raw.get('address29')
271271 else:
272− address_name = address_raw.get(result['category'])
272+ address_name = address_raw.get(result['category'])
273273 elif result['type'] in address_raw:
274− address_name = address_raw.get(result['type'])
274+ address_name = address_raw.get(result['type'])
275275
276276 # add rest of adressdata, if something is already found
277277 if address_name: