$90 GRAYBYTE WORDPRESS FILE MANAGER $47

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/imunify360/venv/lib/python3.11/site-packages/playhouse/

HOME
Current File : /opt/imunify360/venv/lib/python3.11/site-packages/playhouse//test_utils.py
from functools import wraps
import logging


logger = logging.getLogger('peewee')


class _QueryLogHandler(logging.Handler):
    def __init__(self, *args, **kwargs):
        self.queries = []
        logging.Handler.__init__(self, *args, **kwargs)

    def emit(self, record):
        # Counts all entries logged to the "peewee" logger by execute_sql().
        if record.name == 'peewee':
            self.queries.append(record)


class count_queries(object):
    def __init__(self, only_select=False):
        self.only_select = only_select
        self.count = 0

    def get_queries(self):
        return self._handler.queries

    def __enter__(self):
        self._handler = _QueryLogHandler()
        logger.setLevel(logging.DEBUG)
        logger.addHandler(self._handler)
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        logger.removeHandler(self._handler)
        if self.only_select:
            self.count = len([q for q in self._handler.queries
                              if q.msg[0].startswith('SELECT ')])
        else:
            self.count = len(self._handler.queries)


class assert_query_count(count_queries):
    def __init__(self, expected, only_select=False):
        super(assert_query_count, self).__init__(only_select=only_select)
        self.expected = expected

    def __call__(self, f):
        @wraps(f)
        def decorated(*args, **kwds):
            with self:
                ret = f(*args, **kwds)

            self._assert_count()
            return ret

        return decorated

    def _assert_count(self):
        error_msg = '%s != %s' % (self.count, self.expected)
        assert self.count == self.expected, error_msg

    def __exit__(self, exc_type, exc_val, exc_tb):
        super(assert_query_count, self).__exit__(exc_type, exc_val, exc_tb)
        self._assert_count()


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2026 8.59 AM
root / root
0755
__pycache__
--
3 Mar 2026 8.59 AM
root / root
0755
__init__.py
0 KB
13 Feb 2026 12.40 PM
root / root
0644
apsw_ext.py
4.9 KB
13 Feb 2026 12.40 PM
root / root
0644
cockroachdb.py
8.954 KB
13 Feb 2026 12.40 PM
root / root
0644
dataset.py
14.148 KB
13 Feb 2026 12.40 PM
root / root
0644
db_url.py
4.256 KB
13 Feb 2026 12.40 PM
root / root
0644
fields.py
1.659 KB
13 Feb 2026 12.40 PM
root / root
0644
flask_utils.py
8.005 KB
13 Feb 2026 12.40 PM
root / root
0644
hybrid.py
1.492 KB
13 Feb 2026 12.40 PM
root / root
0644
kv.py
5.477 KB
13 Feb 2026 12.40 PM
root / root
0644
migrate.py
32.663 KB
13 Feb 2026 12.40 PM
root / root
0644
mysql_ext.py
3.783 KB
13 Feb 2026 12.40 PM
root / root
0644
pool.py
12.785 KB
13 Feb 2026 12.40 PM
root / root
0644
postgres_ext.py
14.977 KB
13 Feb 2026 12.40 PM
root / root
0644
psycopg3_ext.py
5.345 KB
13 Feb 2026 12.40 PM
root / root
0644
reflection.py
30.418 KB
13 Feb 2026 12.40 PM
root / root
0644
shortcuts.py
11.478 KB
13 Feb 2026 12.40 PM
root / root
0644
signals.py
2.452 KB
13 Feb 2026 12.40 PM
root / root
0644
sqlcipher_ext.py
3.547 KB
13 Feb 2026 12.40 PM
root / root
0644
sqlite_changelog.py
4.681 KB
13 Feb 2026 12.40 PM
root / root
0644
sqlite_ext.py
47.383 KB
13 Feb 2026 12.40 PM
root / root
0644
sqlite_udf.py
13.345 KB
13 Feb 2026 12.40 PM
root / root
0644
sqliteq.py
10.565 KB
13 Feb 2026 12.40 PM
root / root
0644
test_utils.py
1.811 KB
13 Feb 2026 12.40 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF