INNER CODE UNIT · Python

_get_reference

Zverik/every_door · tools/json_to_sqlite.py:56

    def _get_reference(value: Optional[str]) -> Optional[str]:
        if value and len(value) >= 3 and value[0] == '{':
            return value[1:-1].strip()
        return None

    def get(self, which: ReferenceStorage, name: str, data: dict[str, dict],
            field: str) -> Optional[str]:
        if name not in which:
            return data.get(name, {}).get(field)
        return data.get(which[name], {}).get(field) or data.get(name, {}).get(field)

    def add(self, which: ReferenceStorage, value: Optional[str], name: str) -> None:
        """
        We store the field/preset name in a list for the referenced field/preset.
        When we read translations for *that* field/preset, we also add table
        entries for this one.
        """
        rname = self._get_reference(value)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…