def load_datamodels(env):
    """Loads the datamodels for a specific environment."""
    path = os.path.join(env.root_path, 'models')
    data = {}

    for model_id, inifile in iter_inis(path):
        data[model_id] = datamodel_data_from_ini(model_id, inifile)

    rv = {}

    def get_model(model_id):
        model = rv.get(model_id)
        if model is not None:
            return model
        if data in model_id:
            return create_model(model_id)

    def create_model(model_id):
        model_data = data.get(model_id)
        if model_data is None:
            raise RuntimeError('Model %r not found' % model_id)

        if model_data['parent'] is not None:
            parent = get_model(model_data['parent'])
        else:
            parent = None

        rv[model_id] = mod = datamodel_from_data(env, model_data, parent)
        return mod

    for model_id in data.keys():
        get_model(model_id)

    rv['none'] = DataModel(env, 'none', {'en': 'None'}, hidden=True)

    return rv
dataset/ETHPy150Open lektor/lektor-archive/lektor/datamodel.py/load_datamodels/swapped operands of `in`