GRAYBYTE WORDPRESS FILE MANAGER8436

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/hc_python/lib/python3.12/site-packages/alembic/testing/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/hc_python/lib/python3.12/site-packages/alembic/testing//util.py
# testing/util.py
# Copyright (C) 2005-2019 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from __future__ import annotations

import types
from typing import Union

from sqlalchemy.util import inspect_getfullargspec

from ..util import sqla_2


def flag_combinations(*combinations):
    """A facade around @testing.combinations() oriented towards boolean
    keyword-based arguments.

    Basically generates a nice looking identifier based on the keywords
    and also sets up the argument names.

    E.g.::

        @testing.flag_combinations(
            dict(lazy=False, passive=False),
            dict(lazy=True, passive=False),
            dict(lazy=False, passive=True),
            dict(lazy=False, passive=True, raiseload=True),
        )


    would result in::

        @testing.combinations(
            ('', False, False, False),
            ('lazy', True, False, False),
            ('lazy_passive', True, True, False),
            ('lazy_passive', True, True, True),
            id_='iaaa',
            argnames='lazy,passive,raiseload'
        )

    """
    from sqlalchemy.testing import config

    keys = set()

    for d in combinations:
        keys.update(d)

    keys = sorted(keys)

    return config.combinations(
        *[
            ("_".join(k for k in keys if d.get(k, False)),)
            + tuple(d.get(k, False) for k in keys)
            for d in combinations
        ],
        id_="i" + ("a" * len(keys)),
        argnames=",".join(keys),
    )


def resolve_lambda(__fn, **kw):
    """Given a no-arg lambda and a namespace, return a new lambda that
    has all the values filled in.

    This is used so that we can have module-level fixtures that
    refer to instance-level variables using lambdas.

    """

    pos_args = inspect_getfullargspec(__fn)[0]
    pass_pos_args = {arg: kw.pop(arg) for arg in pos_args}
    glb = dict(__fn.__globals__)
    glb.update(kw)
    new_fn = types.FunctionType(__fn.__code__, glb)
    return new_fn(**pass_pos_args)


def metadata_fixture(ddl="function"):
    """Provide MetaData for a pytest fixture."""

    from sqlalchemy.testing import config
    from . import fixture_functions

    def decorate(fn):
        def run_ddl(self):
            from sqlalchemy import schema

            metadata = self.metadata = schema.MetaData()
            try:
                result = fn(self, metadata)
                metadata.create_all(config.db)
                # TODO:
                # somehow get a per-function dml erase fixture here
                yield result
            finally:
                metadata.drop_all(config.db)

        return fixture_functions.fixture(scope=ddl)(run_ddl)

    return decorate


def _safe_int(value: str) -> Union[int, str]:
    try:
        return int(value)
    except:
        return value


def testing_engine(url=None, options=None, future=False):
    from sqlalchemy.testing import config
    from sqlalchemy.testing.engines import testing_engine

    if not future:
        future = getattr(config._current.options, "future_engine", False)

    if not sqla_2:
        kw = {"future": future} if future else {}
    else:
        kw = {}
    return testing_engine(url, options, **kw)

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 04 2025 08:00:29
root / root
0755
__pycache__
--
April 04 2025 08:00:29
root / root
0755
plugin
--
April 04 2025 08:00:29
root / root
0755
suite
--
April 04 2025 08:00:29
root / root
0755
__init__.py
1.132 KB
April 04 2025 08:00:29
root / root
0644
assertions.py
5.074 KB
April 04 2025 08:00:29
root / root
0644
env.py
10.29 KB
April 04 2025 08:00:29
root / root
0644
fixtures.py
8.913 KB
April 04 2025 08:00:29
root / root
0644
requirements.py
4.082 KB
April 04 2025 08:00:29
root / root
0644
schemacompare.py
4.725 KB
April 04 2025 08:00:29
root / root
0644
util.py
3.271 KB
April 04 2025 08:00:29
root / root
0644
warnings.py
0.812 KB
April 04 2025 08:00:29
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF