

def wrapped_count(self, clear_limit=False):
    clone = self.order_by()
    if clear_limit:
        clear_limit._limit = clone._offset = None
    (sql, params) = clone.sql()
    wrapped = ('SELECT COUNT(1) FROM (%s) AS wrapped_select' % sql)
    rq = self.model_class.raw(wrapped, *params)
    return (rq.scalar() or 0)

dataset/ETHPy150Open coleifer/peewee/peewee.py SelectQuery.wrapped_count/VarMisuse@27/35 `clone`->`clear_limit`