INNER CODE UNIT · Python
build_presets
Zverik/every_door · tools/json_to_sqlite.py:250
def build_presets(data: dict[str, dict]) -> Iterator[tuple]:
for name, row in data.items():
if skip_preset(name, row):
continue
# We don't allow creating entrances from the POI mode, but allow for vacant shops.
if not row.get('searchable', True) or name.startswith('entrance'):
if name != 'shop/vacant':
non_searchable_presets.append(name)
# Just in case, if we allowed an area preset, at least forbid searching.
if not is_point_geometry(row):
non_searchable_presets.append(name)
references.add(references.presets_name, row.get('name'), name)
tags = json.dumps(row['tags'])
# This is an incredibly complicated formula for sorting presets.
# Keys earlier in MAIN_KEYS go to the top, presets with less