forked from zaclys/searxng
		
	[fix] openstreetmap - fix some minor whitespace & indentation issues
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
		
							parent
							
								
									40956e8e6b
								
							
						
					
					
						commit
						bf10b4a857
					
				
					 3 changed files with 38 additions and 50 deletions
				
			
		|  | @ -1,8 +1,8 @@ | ||||||
| # SPDX-License-Identifier: AGPL-3.0-or-later | # SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| """ |  | ||||||
|  OpenStreetMap (Map) |  | ||||||
| """ |  | ||||||
| # lint: pylint | # lint: pylint | ||||||
|  | """OpenStreetMap (Map) | ||||||
|  | 
 | ||||||
|  | """ | ||||||
| # pylint: disable=missing-function-docstring | # pylint: disable=missing-function-docstring | ||||||
| 
 | 
 | ||||||
| import re | import re | ||||||
|  | @ -151,16 +151,13 @@ def response(resp): | ||||||
|     user_language = resp.search_params['language'] |     user_language = resp.search_params['language'] | ||||||
| 
 | 
 | ||||||
|     if resp.search_params['route']: |     if resp.search_params['route']: | ||||||
|         results.append( |         results.append({ | ||||||
|             { |             'answer': gettext('Get directions'), | ||||||
|                 'answer': gettext('Get directions'), |             'url': route_url.format(*resp.search_params['route'].groups()), | ||||||
|                 'url': route_url.format(*resp.search_params['route'].groups()), |             }) | ||||||
|             } |  | ||||||
|         ) |  | ||||||
| 
 | 
 | ||||||
|     fetch_wikidata(nominatim_json, user_language) |     fetch_wikidata(nominatim_json, user_language) | ||||||
| 
 | 
 | ||||||
|     # parse results |  | ||||||
|     for result in nominatim_json: |     for result in nominatim_json: | ||||||
|         title, address = get_title_address(result) |         title, address = get_title_address(result) | ||||||
| 
 | 
 | ||||||
|  | @ -173,29 +170,27 @@ def response(resp): | ||||||
|         links, link_keys = get_links(result, user_language) |         links, link_keys = get_links(result, user_language) | ||||||
|         data = get_data(result, user_language, link_keys) |         data = get_data(result, user_language, link_keys) | ||||||
| 
 | 
 | ||||||
|         # append result |         results.append({ | ||||||
|         results.append( |             'template': 'map.html', | ||||||
|             { |             'title': title, | ||||||
|                 'template': 'map.html', |             'address': address, | ||||||
|                 'title': title, |             'address_label': get_key_label('addr', user_language), | ||||||
|                 'address': address, |             'url': url, | ||||||
|                 'address_label': get_key_label('addr', user_language), |             'osm': osm, | ||||||
|                 'url': url, |             'geojson': geojson, | ||||||
|                 'osm': osm, |             'img_src': img_src, | ||||||
|                 'geojson': geojson, |             'links': links, | ||||||
|                 'img_src': img_src, |             'data': data, | ||||||
|                 'links': links, |             'type': get_tag_label( | ||||||
|                 'data': data, |                 result.get('category'), result.get('type', ''), user_language | ||||||
|                 'type': get_tag_label(result.get('category'), result.get('type', ''), user_language), |             ), | ||||||
|                 'type_icon': result.get('icon'), |             'type_icon': result.get('icon'), | ||||||
|                 'content': '', |             'content': '', | ||||||
|                 'longitude': result['lon'], |             'longitude': result['lon'], | ||||||
|                 'latitude': result['lat'], |             'latitude': result['lat'], | ||||||
|                 'boundingbox': result['boundingbox'], |             'boundingbox': result['boundingbox'], | ||||||
|             } |         }) | ||||||
|         ) |  | ||||||
| 
 | 
 | ||||||
|     # return results |  | ||||||
|     return results |     return results | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -353,13 +348,11 @@ def get_links(result, user_language): | ||||||
|             url, url_label = mapping_function(raw_value) |             url, url_label = mapping_function(raw_value) | ||||||
|             if url.startswith('https://wikidata.org'): |             if url.startswith('https://wikidata.org'): | ||||||
|                 url_label = result.get('wikidata', {}).get('itemLabel') or url_label |                 url_label = result.get('wikidata', {}).get('itemLabel') or url_label | ||||||
|             links.append( |             links.append({ | ||||||
|                 { |                 'label': get_key_label(k, user_language), | ||||||
|                     'label': get_key_label(k, user_language), |                 'url': url, | ||||||
|                     'url': url, |                 'url_label': url_label, | ||||||
|                     'url_label': url_label, |             }) | ||||||
|                 } |  | ||||||
|             ) |  | ||||||
|             link_keys.add(k) |             link_keys.add(k) | ||||||
|     return links, link_keys |     return links, link_keys | ||||||
| 
 | 
 | ||||||
|  | @ -379,13 +372,11 @@ def get_data(result, user_language, ignore_keys): | ||||||
|             continue |             continue | ||||||
|         k_label = get_key_label(k, user_language) |         k_label = get_key_label(k, user_language) | ||||||
|         if k_label: |         if k_label: | ||||||
|             data.append( |             data.append({ | ||||||
|                 { |                 'label': k_label, | ||||||
|                     'label': k_label, |                 'key': k, | ||||||
|                     'key': k, |                 'value': v, | ||||||
|                     'value': v, |             }) | ||||||
|                 } |  | ||||||
|             ) |  | ||||||
|     data.sort(key=lambda entry: (get_key_rank(entry['key']), entry['label'])) |     data.sort(key=lambda entry: (get_key_rank(entry['key']), entry['label'])) | ||||||
|     return data |     return data | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -330,9 +330,6 @@ article.result-images[data-vim-selected]::before { | ||||||
|       text-align: left; |       text-align: left; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .torrent_result { | .torrent_result { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Markus Heiser
						Markus Heiser