INNER CODE UNIT · Python
fetch
Zverik/every_door · tools/json_to_sqlite.py:78
def fetch(row: dict, field: str, data: dict[str, dict]) -> Optional[str]:
"""
Some values may reference other fields/presets instead of just stating a string.
That implies that translations are also referenced. For translations, we store
them in the ``add`` method, while here we just fetch the referenced value
from the same file, different field/preset.
"""
value = row.get(field)
rname = ReferenceStorageImpl._get_reference(value)
if rname and rname in data:
return data[rname].get(field)
return value
references = ReferenceStorageImpl()
def open_or_download(git_path: Optional[str], filename: str, from_nsi: bool = False) -> dict: