__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# engine/_py_util.py
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
import typing
from typing import Any
from typing import Mapping
from typing import Optional
from typing import Tuple
from .. import exc
if typing.TYPE_CHECKING:
from .interfaces import _CoreAnyExecuteParams
from .interfaces import _CoreMultiExecuteParams
from .interfaces import _DBAPIAnyExecuteParams
from .interfaces import _DBAPIMultiExecuteParams
_no_tuple: Tuple[Any, ...] = ()
def _distill_params_20(
params: Optional[_CoreAnyExecuteParams],
) -> _CoreMultiExecuteParams:
if params is None:
return _no_tuple
# Assume list is more likely than tuple
elif isinstance(params, list) or isinstance(params, tuple):
# collections_abc.MutableSequence): # avoid abc.__instancecheck__
if params and not isinstance(params[0], (tuple, Mapping)):
raise exc.ArgumentError(
"List argument must consist only of tuples or dictionaries"
)
return params
elif isinstance(params, dict) or isinstance(
# only do immutabledict or abc.__instancecheck__ for Mapping after
# we've checked for plain dictionaries and would otherwise raise
params,
Mapping,
):
return [params]
else:
raise exc.ArgumentError("mapping or list expected for parameters")
def _distill_raw_params(
params: Optional[_DBAPIAnyExecuteParams],
) -> _DBAPIMultiExecuteParams:
if params is None:
return _no_tuple
elif isinstance(params, list):
# collections_abc.MutableSequence): # avoid abc.__instancecheck__
if params and not isinstance(params[0], (tuple, Mapping)):
raise exc.ArgumentError(
"List argument must consist only of tuples or dictionaries"
)
return params
elif isinstance(params, (tuple, dict)) or isinstance(
# only do abc.__instancecheck__ for Mapping after we've checked
# for plain dictionaries and would otherwise raise
params,
Mapping,
):
# cast("Union[List[Mapping[str, Any]], Tuple[Any, ...]]", [params])
return [params] # type: ignore
else:
raise exc.ArgumentError("mapping or sequence expected for parameters")
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 2.75 KB | 0644 |
|
| _py_processors.py | File | 3.66 KB | 0644 |
|
| _py_row.py | File | 3.7 KB | 0644 |
|
| _py_util.py | File | 2.43 KB | 0644 |
|
| base.py | File | 120.02 KB | 0644 |
|
| characteristics.py | File | 4.65 KB | 0644 |
|
| create.py | File | 32.44 KB | 0644 |
|
| cursor.py | File | 74.52 KB | 0644 |
|
| default.py | File | 82.72 KB | 0644 |
|
| events.py | File | 36.52 KB | 0644 |
|
| interfaces.py | File | 110.38 KB | 0644 |
|
| mock.py | File | 4.08 KB | 0644 |
|
| processors.py | File | 2.32 KB | 0644 |
|
| reflection.py | File | 73.62 KB | 0644 |
|
| result.py | File | 75.82 KB | 0644 |
|
| row.py | File | 11.75 KB | 0644 |
|
| strategies.py | File | 442 B | 0644 |
|
| url.py | File | 30.34 KB | 0644 |
|
| util.py | File | 5.55 KB | 0644 |
|