def fields_from_data(env, data, parent_fields=None):
    fields = []
    known_fields = set()

    for name, options in data:
        ty = env.types[options.get('type', 'string')]
        fields.append(Field(env=env, name=name, type=ty, options=options))
        known_fields.add(name)

    if parent_fields is not None:
        prepended_fields = []
        for field in parent_fields:
            if field.name not in known_fields:
                prepended_fields.append(field)
        fields = prepended_fields + fields

    return fields
dataset/ETHPy150Open lektor/lektor-archive/lektor/datamodel.py/fields_from_data/original