def construct_instance(self, row):
        if not self.column_meta:
            # use attribute names pulled from the result cursor description,
            # and do not attempt to follow joined models
            row_dict = self._row_to_dict(row)
            return self.model_from_rowset(self.model, row_dict)
        else:
            # we have columns, models, and a graph of joins to reconstruct
            collected_models = {}
            for i, (model, col) in enumerate(self.column_meta):
                value = row[i]

                if isinstance(col, tuple):
                    if len(col) == 3:
                        model = self.model # special-case aggregates
                        col_name = attr = col[2]
                    else:
                        col_name, attr = col
                else:
                    col_name = attr = col

                if model not in collected_models:
                    collected_models[model] = model()

                instance = collected_models[model]

                if col_name in instance._meta.columns:
                    field = instance._meta.columns[col_name]
                    setattr(instance, field.name, field.python_value(value))
                else:
                    setattr(instance, attr, value)

            return self.follow_joins(self.join_meta, collected_models, self.model)
dataset/ETHPy150Open kuri65536/python-for-android/sl4atools/fullscreenwrapper2/examples/calcount2_example/peewee.py/QueryResultWrapper.construct_instance/original