

def __new__(cls, query, fields=None, backref=None, rel_models=None, field_to_name=None, model=None):
    if fields:
        if backref:
            rel_models = [field.model_class for field in fields]
            foreign_key_attrs = [field.to_field.name for field in fields]
        else:
            rel_models = [field.rel_model for field in fields]
            foreign_key_attrs = [field.name for field in fields]
        field_to_name = list(zip(fields, foreign_key_attrs))
    model = query.model_class
    return super(PrefetchResult, cls).__new__(cls, query, fields, backref, rel_models, field_to_name, model)

dataset/ETHPy150Open coleifer/peewee/peewee.py PrefetchResult.__new__/original