__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# sql/_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 Dict
from typing import Tuple
from typing import Union
from ..util.typing import Literal
if typing.TYPE_CHECKING:
from .cache_key import CacheConst
class prefix_anon_map(Dict[str, str]):
"""A map that creates new keys for missing key access.
Considers keys of the form "<ident> <name>" to produce
new symbols "<name>_<index>", where "index" is an incrementing integer
corresponding to <name>.
Inlines the approach taken by :class:`sqlalchemy.util.PopulateDict` which
is otherwise usually used for this type of operation.
"""
def __missing__(self, key: str) -> str:
(ident, derived) = key.split(" ", 1)
anonymous_counter = self.get(derived, 1)
self[derived] = anonymous_counter + 1 # type: ignore
value = f"{derived}_{anonymous_counter}"
self[key] = value
return value
class cache_anon_map(
Dict[Union[int, "Literal[CacheConst.NO_CACHE]"], Union[Literal[True], str]]
):
"""A map that creates new keys for missing key access.
Produces an incrementing sequence given a series of unique keys.
This is similar to the compiler prefix_anon_map class although simpler.
Inlines the approach taken by :class:`sqlalchemy.util.PopulateDict` which
is otherwise usually used for this type of operation.
"""
_index = 0
def get_anon(self, object_: Any) -> Tuple[str, bool]:
idself = id(object_)
if idself in self:
s_val = self[idself]
assert s_val is not True
return s_val, True
else:
# inline of __missing__
self[idself] = id_ = str(self._index)
self._index += 1
return id_, False
def __missing__(self, key: int) -> str:
self[key] = val = str(self._index)
self._index += 1
return val
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 5.68 KB | 0644 |
|
| _dml_constructors.py | File | 3.71 KB | 0644 |
|
| _elements_constructors.py | File | 61.16 KB | 0644 |
|
| _orm_types.py | File | 625 B | 0644 |
|
| _py_util.py | File | 2.12 KB | 0644 |
|
| _selectable_constructors.py | File | 19.9 KB | 0644 |
|
| _typing.py | File | 12.55 KB | 0644 |
|
| annotation.py | File | 17.82 KB | 0644 |
|
| base.py | File | 72.21 KB | 0644 |
|
| cache_key.py | File | 32.88 KB | 0644 |
|
| coercions.py | File | 39.7 KB | 0644 |
|
| compiler.py | File | 269.12 KB | 0644 |
|
| crud.py | File | 55.19 KB | 0644 |
|
| ddl.py | File | 46.32 KB | 0644 |
|
| default_comparator.py | File | 16.32 KB | 0644 |
|
| dml.py | File | 64.68 KB | 0644 |
|
| elements.py | File | 173.16 KB | 0644 |
|
| events.py | File | 17.88 KB | 0644 |
|
| expression.py | File | 7.41 KB | 0644 |
|
| functions.py | File | 62.36 KB | 0644 |
|
| lambdas.py | File | 48.04 KB | 0644 |
|
| naming.py | File | 6.7 KB | 0644 |
|
| operators.py | File | 74.99 KB | 0644 |
|
| roles.py | File | 7.48 KB | 0644 |
|
| schema.py | File | 224.63 KB | 0644 |
|
| selectable.py | File | 235.41 KB | 0644 |
|
| sqltypes.py | File | 125.93 KB | 0644 |
|
| traversals.py | File | 32.88 KB | 0644 |
|
| type_api.py | File | 82.85 KB | 0644 |
|
| util.py | File | 46.96 KB | 0644 |
|
| visitors.py | File | 35.47 KB | 0644 |
|