game.tips.append(f'Мимо как раз проезжает полупустой {v["name"]}. Можно успеть')
for s in near_objects['sightseeings']:
- game.tips.append(f'Кстати, недалеко интересный туристический объект: ' + s["name"])
+ type = convert_sightseeing_type(s['type'])
+ game.tips.append(f'Кстати, недалеко ' + (type if type else 'интересный туристический объект') + ': ' + s["name"])
shuffle(game.tips)
return ''
+def convert_sightseeing_type(type):
+ if type == 'memorial':
+ return 'памятник'
+ if type == 'attraction':
+ return None
+ if type == 'artwork':
+ return None
+ if type == 'resort':
+ return None
+ if type == 'viewpoint':
+ return None
+ if type == 'museum':
+ return None
+ if type == 'yes':
+ return None
+ if type == 'building':
+ return None
+ return None
+
def show_tips(game, count):
not_shown_tips = [tip for tip in game.tips if tip not in game.shown_tips]
'name': re.split(r'\.', x['data']['tag']['name'].replace(':', '.'))[0]} for x in filter_vehicles(objects)
]
sightseeings = [
- {'name': x['data']['tag']['name']} for x in filter_sightseeings(objects)
+ {'name': x['data']['tag']['name'], 'type': x['data']['tag']['tourism'] if 'tourism' in x['data']['tag'] else x['data']['tag']['historic']} for x in filter_sightseeings(objects)
]
districts = [
{'name': x['data']['tag']['name']} for x in filter_districts(objects)
try:
summary = w.summary(query)
- full_description = re.split(r'\) —', summary)[1]
+
+ full_description = re.split(r'\) —', summary)[-1]
description = re.split(r'\.', full_description)[0]
cache[query] = (True, description.strip())
if __name__ == '__main__':
- print(parse_summary('Ð\91ебелÑ\8f'))
+ print(parse_summary('СеÑ\80ова'))