in eland/field_mappings.py [0:0]
def flatten(x, name=""):
if isinstance(x, dict):
for a in x:
if a == "type" and isinstance(
x[a], str
): # 'type' can be a name of a field
field_name = name[:-1]
field_type = x[a]
# if field_type is 'date' keep track of the format info when available
date_format = None
if field_type == "date" and "format" in x:
date_format = x["format"]
# If there is a conflicting type, warn - first values added wins
if field_name in fields and fields[field_name] != (
field_type,
date_format,
):
warnings.warn(
f"Field {field_name} has conflicting types "
f"{fields[field_name]} != {field_type}",
UserWarning,
)
else:
fields[field_name] = (field_type, date_format)
elif a == "properties" or (not source_only and a == "fields"):
flatten(x[a], name)
elif not (
source_only and a == "fields"
): # ignore multi-field fields for source_only
flatten(x[a], name + a + ".")