$80 GRAYBYTE WORDPRESS FILE MANAGER $27

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

/opt/hc_python/lib/python3.12/site-packages/sqlalchemy/orm/

HOME
Current File : /opt/hc_python/lib/python3.12/site-packages/sqlalchemy/orm//_typing.py
# orm/_typing.py
# Copyright (C) 2022-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 operator
from typing import Any
from typing import Dict
from typing import Mapping
from typing import Optional
from typing import Tuple
from typing import Type
from typing import TYPE_CHECKING
from typing import TypeVar
from typing import Union

from ..engine.interfaces import _CoreKnownExecutionOptions
from ..sql import roles
from ..sql._orm_types import DMLStrategyArgument as DMLStrategyArgument
from ..sql._orm_types import (
    SynchronizeSessionArgument as SynchronizeSessionArgument,
)
from ..sql._typing import _HasClauseElement
from ..sql.elements import ColumnElement
from ..util.typing import Protocol
from ..util.typing import TypeGuard

if TYPE_CHECKING:
    from .attributes import AttributeImpl
    from .attributes import CollectionAttributeImpl
    from .attributes import HasCollectionAdapter
    from .attributes import QueryableAttribute
    from .base import PassiveFlag
    from .decl_api import registry as _registry_type
    from .interfaces import InspectionAttr
    from .interfaces import MapperProperty
    from .interfaces import ORMOption
    from .interfaces import UserDefinedOption
    from .mapper import Mapper
    from .relationships import RelationshipProperty
    from .state import InstanceState
    from .util import AliasedClass
    from .util import AliasedInsp
    from ..sql._typing import _CE
    from ..sql.base import ExecutableOption

_T = TypeVar("_T", bound=Any)


_T_co = TypeVar("_T_co", bound=Any, covariant=True)

_O = TypeVar("_O", bound=object)
"""The 'ORM mapped object' type.

"""


if TYPE_CHECKING:
    _RegistryType = _registry_type

_InternalEntityType = Union["Mapper[_T]", "AliasedInsp[_T]"]

_ExternalEntityType = Union[Type[_T], "AliasedClass[_T]"]

_EntityType = Union[
    Type[_T], "AliasedClass[_T]", "Mapper[_T]", "AliasedInsp[_T]"
]


_ClassDict = Mapping[str, Any]
_InstanceDict = Dict[str, Any]

_IdentityKeyType = Tuple[Type[_T], Tuple[Any, ...], Optional[Any]]

_ORMColumnExprArgument = Union[
    ColumnElement[_T],
    _HasClauseElement[_T],
    roles.ExpressionElementRole[_T],
]


_ORMCOLEXPR = TypeVar("_ORMCOLEXPR", bound=ColumnElement[Any])


class _OrmKnownExecutionOptions(_CoreKnownExecutionOptions, total=False):
    populate_existing: bool
    autoflush: bool
    synchronize_session: SynchronizeSessionArgument
    dml_strategy: DMLStrategyArgument
    is_delete_using: bool
    is_update_from: bool
    render_nulls: bool


OrmExecuteOptionsParameter = Union[
    _OrmKnownExecutionOptions, Mapping[str, Any]
]


class _ORMAdapterProto(Protocol):
    """protocol for the :class:`.AliasedInsp._orm_adapt_element` method
    which is a synonym for :class:`.AliasedInsp._adapt_element`.


    """

    def __call__(self, obj: _CE, key: Optional[str] = None) -> _CE: ...


class _LoaderCallable(Protocol):
    def __call__(
        self, state: InstanceState[Any], passive: PassiveFlag
    ) -> Any: ...


def is_orm_option(
    opt: ExecutableOption,
) -> TypeGuard[ORMOption]:
    return not opt._is_core


def is_user_defined_option(
    opt: ExecutableOption,
) -> TypeGuard[UserDefinedOption]:
    return not opt._is_core and opt._is_user_defined  # type: ignore


def is_composite_class(obj: Any) -> bool:
    # inlining is_dataclass(obj)
    return hasattr(obj, "__composite_values__") or hasattr(
        obj, "__dataclass_fields__"
    )


if TYPE_CHECKING:

    def insp_is_mapper_property(
        obj: Any,
    ) -> TypeGuard[MapperProperty[Any]]: ...

    def insp_is_mapper(obj: Any) -> TypeGuard[Mapper[Any]]: ...

    def insp_is_aliased_class(obj: Any) -> TypeGuard[AliasedInsp[Any]]: ...

    def insp_is_attribute(
        obj: InspectionAttr,
    ) -> TypeGuard[QueryableAttribute[Any]]: ...

    def attr_is_internal_proxy(
        obj: InspectionAttr,
    ) -> TypeGuard[QueryableAttribute[Any]]: ...

    def prop_is_relationship(
        prop: MapperProperty[Any],
    ) -> TypeGuard[RelationshipProperty[Any]]: ...

    def is_collection_impl(
        impl: AttributeImpl,
    ) -> TypeGuard[CollectionAttributeImpl]: ...

    def is_has_collection_adapter(
        impl: AttributeImpl,
    ) -> TypeGuard[HasCollectionAdapter]: ...

else:
    insp_is_mapper_property = operator.attrgetter("is_property")
    insp_is_mapper = operator.attrgetter("is_mapper")
    insp_is_aliased_class = operator.attrgetter("is_aliased_class")
    insp_is_attribute = operator.attrgetter("is_attribute")
    attr_is_internal_proxy = operator.attrgetter("_is_internal_proxy")
    is_collection_impl = operator.attrgetter("collection")
    prop_is_relationship = operator.attrgetter("_is_relationship")
    is_has_collection_adapter = operator.attrgetter(
        "_is_has_collection_adapter"
    )


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Apr 2025 8.03 AM
root / root
0755
__pycache__
--
4 Apr 2025 8.03 AM
root / root
0755
__init__.py
8.265 KB
4 Apr 2025 8.03 AM
root / root
0644
_orm_constructors.py
101.197 KB
4 Apr 2025 8.03 AM
root / root
0644
_typing.py
4.856 KB
4 Apr 2025 8.03 AM
root / root
0644
attributes.py
90.365 KB
4 Apr 2025 8.03 AM
root / root
0644
base.py
26.856 KB
4 Apr 2025 8.03 AM
root / root
0644
bulk_persistence.py
70.96 KB
4 Apr 2025 8.03 AM
root / root
0644
clsregistry.py
17.553 KB
4 Apr 2025 8.03 AM
root / root
0644
collections.py
51.027 KB
4 Apr 2025 8.03 AM
root / root
0644
context.py
112.415 KB
4 Apr 2025 8.03 AM
root / root
0644
decl_api.py
63.446 KB
4 Apr 2025 8.03 AM
root / root
0644
decl_base.py
81.336 KB
4 Apr 2025 8.03 AM
root / root
0644
dependency.py
46.515 KB
4 Apr 2025 8.03 AM
root / root
0644
descriptor_props.py
36.358 KB
4 Apr 2025 8.03 AM
root / root
0644
dynamic.py
9.586 KB
4 Apr 2025 8.03 AM
root / root
0644
evaluator.py
12.063 KB
4 Apr 2025 8.03 AM
root / root
0644
events.py
124.786 KB
4 Apr 2025 8.03 AM
root / root
0644
exc.py
7.239 KB
4 Apr 2025 8.03 AM
root / root
0644
identity.py
9.032 KB
4 Apr 2025 8.03 AM
root / root
0644
instrumentation.py
23.751 KB
4 Apr 2025 8.03 AM
root / root
0644
interfaces.py
47.653 KB
4 Apr 2025 8.03 AM
root / root
0644
loading.py
56.911 KB
4 Apr 2025 8.03 AM
root / root
0644
mapped_collection.py
19.221 KB
4 Apr 2025 8.03 AM
root / root
0644
mapper.py
167.632 KB
4 Apr 2025 8.03 AM
root / root
0644
path_registry.py
25.309 KB
4 Apr 2025 8.03 AM
root / root
0644
persistence.py
60.255 KB
4 Apr 2025 8.03 AM
root / root
0644
properties.py
28.384 KB
4 Apr 2025 8.03 AM
root / root
0644
query.py
115.954 KB
4 Apr 2025 8.03 AM
root / root
0644
relationships.py
125.878 KB
4 Apr 2025 8.03 AM
root / root
0644
scoping.py
76.774 KB
4 Apr 2025 8.03 AM
root / root
0644
session.py
191.518 KB
4 Apr 2025 8.03 AM
root / root
0644
state.py
36.787 KB
4 Apr 2025 8.03 AM
root / root
0644
state_changes.py
6.655 KB
4 Apr 2025 8.03 AM
root / root
0644
strategies.py
117.057 KB
4 Apr 2025 8.03 AM
root / root
0644
strategy_options.py
83.05 KB
4 Apr 2025 8.03 AM
root / root
0644
sync.py
5.644 KB
4 Apr 2025 8.03 AM
root / root
0644
unitofwork.py
26.399 KB
4 Apr 2025 8.03 AM
root / root
0644
util.py
78.937 KB
4 Apr 2025 8.03 AM
root / root
0644
writeonly.py
21.782 KB
4 Apr 2025 8.03 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF