def count(self):
        if self._distinct or self._group_by:
            return self.wrapped_count()

        clone = self.order_by()
        clone._limit = clone._offset = None

        if clone.use_aliases():
            clone.query = 'COUNT(t1.%s)' % (clone.model._meta.pk_col)
        else:
            clone.query = 'COUNT(%s)' % (clone.model._meta.pk_col)

        res = clone.database.execute(*clone.sql())

        return (res.fetchone() or [0])[0]
dataset/ETHPy150Open kuri65536/python-for-android/sl4atools/fullscreenwrapper2/examples/calcount2_example/peewee.py/SelectQuery.count/original