INNER CODE UNIT · Python
normalize
Zverik/every_door · tools/json_to_sqlite.py:130
def normalize(s: Optional[str]) -> Optional[str]:
"""Normalizes unicode and lowers case for searching."""
if not s:
return s
return u"".join([c for c in unicodedata.normalize('NFKD', s.lower().strip())
if not unicodedata.combining(c)])
def store_version(cur):
version = datetime.datetime.now().strftime('%Y%m%d-%H%M')
cur.execute("create table version (version text)")
cur.execute("insert into version (version) values (?)", (version,))
def import_fields(cur, path: Optional[str]):
data = open_or_download(path, 'fields.min.json', False)
cur.execute("""create table fields (
name text primary key,