PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/sqlalchemy/orm/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/sqlalchemy/orm/__pycache__/interfaces.cpython-312.pyc

�

���g���
�0�dZddlmZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#dd lm$Z$dd!lm%Z%dd"lm&Z&dd#lm'Z'dd$lm(Z(dd%lm)Z)dd&lm*Z*d'd(lm+Z+d'dlmZ,d'd)lm-Z-d'd*lm.Z.d'd+l/m0Z0d'd,l/m1Z1d'd-l/m2Z2d'd.l3m4Z4d'd/l3m5Z5d'd0l6m7Z7d'd1l8m9Z9d'd2l:m;Z;d'd3l<m=Z=d'd4l.m>Z>d'd5l?m@Z@d'd6l?mAZAej*r�dd7lBmCZCdd8lBmDZDdd9lBmEZEdd:lBmFZFdd;lBmGZGdd<lHmIZIdd=lmJZJdd>lKmLZLdd?lKmMZMdd@lKmNZNddAlOmPZPddBlQmRZRddClSmTZTddDlUmVZVddElmWZWddFlXmYZYddGlZm[Z[ddHl\m]Z]ddIl^m_Z_ddJl.m`Z`ddKl.maZad'dLlbmcZcd'dMldmeZed'dNldmfZfd'dOldmgZgd'dPldmhZhd'dQl8miZid'dRljmkZkd'dSl?mlZleedTfZmedUe�V�ZnedWedX�Y�ZoedZd[�V�ZpGd\�d]e1j��ZrGd^�d_e1j�e1j�en�ZuGd`�daeuen�ZvGdb�dce1j��ZxGdd�deeA�ZyGdf�dg�ZzGdh�die�Z{e{e4j�e4j�e4j�e4j�e4j�e4j�e4j��Z}e{dje4j�e4j�e4j�e4j�e4j�e4j��Z~Gdk�dl�ZGdm�dneeen�Z�e-�jGdo�dpe7eeene"e.�j��Z�e-�jGdq�dre*eoeeoe9��Z�Gds�dte�en�Z�Gdu�dve5�Z�Gdw�dxe7e��Z�Gdy�dze��Z�Gd{�d|e��Z�Gd}�d~e��Z�e.�jdd�d���Gd��d�e���Z�Gd��d��Z�y)�z�

Contains various base classes used throughout the ORM.

Defines some key base classes prominent within the internals.

This module and the classes within are mostly private, though some attributes
are exposed when inspecting mappings.

�)�annotationsN)�Any)�Callable)�cast)�ClassVar)�Dict)�Generic)�Iterator)�List)�
NamedTuple)�NoReturn)�Optional)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�exc)�
path_registry)�_MappedAttribute)�EXT_CONTINUE)�EXT_SKIP)�EXT_STOP)�InspectionAttr)�InspectionAttrInfo)�
MANYTOMANY)�	MANYTOONE)�NO_KEY)�NO_VALUE)�NotExtension)�	ONETOMANY)�RelationshipDirection)�SQLORMOperations�)�
ColumnElement)�
inspection)�util)�	operators)�roles)�visitors)�_NoArg)�ExecutableOption)�HasCacheKey)�ColumnOperators)�Column)�
TypeEngine)�warn_deprecated)�RODescriptorReference)�	TypedDict)�_EntityType)�_IdentityKeyType)�
_InstanceDict)�_InternalEntityType)�_ORMAdapterProto)�InstrumentedAttribute)�Mapped)�
_MapperEntity)�ORMCompileState)�QueryContext)�RegistryType)�_ClassScanMapperConfig)�_PopulatorDict)�Mapper)�AbstractEntityRegistry)�Query)�Session)�
InstanceState)�_LoadElement)�AliasedInsp)�
ORMAdapter)�Result)�_ColumnExpressionArgument)�_ColumnsClauseArgument)�_DMLColumnArgument)�	_InfoType)�OperatorType)�_TraverseInternalsType)�_AnnotationScanType.�_T)�bound�_T_coT)rU�	covariant�_TLS�Type[LoaderStrategy]c��eZdZdZdZy)�ORMStatementRole�z?Executable SQL or text() construct, including ORM aware objectsN��__name__�
__module__�__qualname__�	__slots__�
_role_namer\��J/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/orm/interfaces.pyr[r[ss���I�I�rcr[c��eZdZdZdZy)�ORMColumnsClauseRoler\z7ORM mapped entity, aliased entity, or Column expressionNr]r\rcrdrfrfzs���I�J�Jrcrfc��eZdZdZdZy)�ORMEntityColumnsClauseRoler\zORM mapped or aliased entityNr]r\rcrdrhrh�s���I�/�Jrcrhc��eZdZdZdZy)�ORMFromClauseRoler\z5ORM mapped entity, aliased entity, or FROM expressionNr]r\rcrdrjrj�s���I�H�Jrcrjc�@�eZdZUded<ded<ded<ded<d	ed
<y)�ORMColumnDescription�str�namez!Union[Type[Any], TypeEngine[Any]]�type�bool�aliasedz_ColumnsClauseArgument[Any]�exprz%Optional[_ColumnsClauseArgument[Any]]�entityN)r^r_r`�__annotations__r\rcrdrlrl�s ��

�I�,�+�
�M�
%�%�1�1rcrlc�b�eZdZdZedd��Zdd�Z																				d	d�Zd
d�Zy)�_IntrospectsAnnotationsr\c��|jS�N)r^)�clss rd�_mapper_property_namez-_IntrospectsAnnotations._mapper_property_name�s���|�|�rcc�<�td|j��d���)zrreturn a copy of this object to use in declarative when the
        object is found inside of an Annotated object.zUse of the z> construct inside of an Annotated object is not yet supported.)�NotImplementedErrorrz��selfs rd�found_in_pep593_annotatedz1_IntrospectsAnnotations.found_in_pep593_annotated�s.��"��$�4�4�6�9�:L�
L�
�	
rcc
��y)zyPerform class-specific initializaton at early declarative scanning
        time.

        .. versionadded:: 2.0

        Nr\)
r~�	decl_scan�registryry�originating_module�key�mapped_container�
annotation�extracted_mapped_annotation�is_dataclass_fields
          rd�declarative_scanz(_IntrospectsAnnotations.declarative_scan���rcc	�p�tjd|j�d|�d|j��d���)Nz4Python typing annotation is required for attribute "�.z " when primary argument(s) for "z#" construct are None or not present)�sa_exc�
ArgumentErrorr^rz)r~r�rys   rd�_raise_for_requiredz+_IntrospectsAnnotations._raise_for_required�sG���"�"�����~�Q�s�e�$��*�*�,�-�.0�
0�
�	
rcN��returnrm)r�r)r�rBr�rAry�	Type[Any]r��
Optional[str]r�rmr�zOptional[Type[Mapped[Any]]]r��Optional[_AnnotationScanType]r�r�r�rpr��None)r�rmryr�r�r
)	r^r_r`ra�classmethodrzrr�r�r\rcrdrvrv�s����I�����
��)�����	�
*���
�6��2��&C��!��
��&
rcrvc��eZdZUdZded<ded<ded<ded<ded	<ded
<ded<dd
�Ze										dd��Zy)�_AttributeOptionsz�define Python-local attribute behavior options common to all
    :class:`.MapperProperty` objects.

    Currently this includes dataclass-generation arguments.

    .. versionadded:: 2.0

    zUnion[_NoArg, bool]�dataclasses_init�dataclasses_reprzUnion[_NoArg, Any]�dataclasses_defaultz Union[_NoArg, Callable[[], Any]]�dataclasses_default_factory�dataclasses_compare�dataclasses_kw_onlyzUnion[_NoArg, bool, None]�dataclasses_hashc�@��i}|jtjur|j|d<|jtjur|j|d<|jtjur|j|d<|j
tjur|j
|d<|jtjur|j|d<|jtjur|j|d<|jtjur|j|d<d|vrt|d�rtd|�d	�d
�d|vr4|ds/d|vr+t|d�sd|vr|jd���fd�|d<tjdi|��S)
z<Return a ``dataclasses.Field`` object given these arguments.�default_factory�default�init�repr�compare�kw_only�hashzBCallable object passed to the ``default`` parameter for attribute a� in a ORM-mapped Dataclasses context is ambiguous, and this use will raise an error in a future release.  If this callable is intended to produce Core level INSERT default values for an underlying ``Column``, use the ``mapped_column.insert_default`` parameter instead.  To establish this callable as providing a default value for instances of the dataclass itself, use the ``default_factory`` dataclasses parameter.z2.0c����Srxr\)r�s�rd�<lambda>z7_AttributeOptions._as_dataclass_field.<locals>.<lambda>s���Grcr\)r�r.�NO_ARGr�r�r�r�r�r��callabler4�pop�dataclasses�field)r~r��kwr�s   @rd�_as_dataclass_fieldz%_AttributeOptions._as_dataclass_field�s���� ���+�+�6�=�=�@�$(�$D�$D�B� �!��#�#�6�=�=�8� �4�4�B�y�M�� � ��
�
�5��.�.�B�v�J�� � ��
�
�5��.�.�B�v�J��#�#�6�=�=�8� �4�4�B�y�M��#�#�6�=�=�8� �4�4�B�y�M�� � ��
�
�5��.�.�B�v�J���?�x��9�
�6�
�� �G�$=�	=��
�
�b�L��v�J��R���R�	�]�+�!��+��f�f�Y�'�G�$3�B� �!�� � �&�2�&�&rcc��t|t�r |jj|�}|||fS|tj
ur|||fS|�Jd��||fS)z�given attribute key, annotation, and value from a class, return
        the argument tuple we would pass to dataclasses.make_dataclass()
        for this attribute.

        z/Mapped[] received without a mapping declaration)�
isinstance�_DCAttributeOptions�_attribute_optionsr�r.r�)ryr�r�r��elem�dc_fields      rd�!_get_arguments_for_make_dataclassz3_AttributeOptions._get_arguments_for_make_dataclasssl�� �d�/�0��.�.�B�B�3�G�H���X�.�.�
����
&���T�*�*�
�
)�
L�K�K�5���$�$rcN)r�rmr�r)
r�rmr�rSr��
Optional[Any]r�rTr�z_Union[Tuple[str, _AnnotationScanType], Tuple[str, _AnnotationScanType, dataclasses.Field[Any]]])r^r_r`�__doc__rtr�r�r�r\rcrdr�r��s}���*�)�)�)�+�+�!A�A�,�,�,�,�/�/�/'�b�%%�
�%%�(�%%�(�	%%�
�%%�
�
%%��%%rcr�Fc�,�eZdZUdZdZded<	ded<y)r�awmixin for descriptors or configurational objects that include dataclass
    field options.

    This includes :class:`.MapperProperty`, :class:`._MapsColumn` within
    the ORM, but also includes :class:`.AssociationProxy` within ext.
    Can in theory be used for other descriptors that serve a similar role
    as association proxy.   (*maybe* hybrids, not sure yet.)

    r\r�r�rp�_has_dataclass_argumentsN)r^r_r`r�rartr\rcrdr�r�Bs!����I�)�)��#�"rcr�c�8�eZdZdZdZedd��Zedd��Zy)�_MapsColumnsz�interface for declarative-capable construct that delivers one or more
    Column objects to the declarative process to be part of a Table.
    r\c��t��)zAreturn a MapperProperty to be assigned to the declarative mapping�r|r}s rd�mapper_property_to_assignz&_MapsColumns.mapper_property_to_assign`s
��"�#�#rcc��t��)zfA list of Column objects that should be declaratively added to the
        new Table object.

        r�r}s rd�columns_to_assignz_MapsColumns.columns_to_assignes
��"�#�#rcN)r�zOptional[MapperProperty[_T]])r�zList[Tuple[Column[_T], int]])r^r_r`r�ra�propertyr�r�r\rcrdr�r�Ys4����I�
�$��$��$��$rcr�c���eZdZUdZdZdejjfdejjfgZ	de
d<esdZdZ
	d	e
d
<	de
d<	de
d<	d
Zde
d<	de
d<	de
d<	d!d�Z												d"d�Z																d#d�Z	d$											d%d�Zd&d�Zd'd�Z		d(					d)d�Zd*d�Zed+d��Zd*d�Zd'd�Z																		d,d�Zd-d �Zy).�MapperPropertya�Represent a particular class attribute mapped by :class:`_orm.Mapper`.

    The most common occurrences of :class:`.MapperProperty` are the
    mapped :class:`_schema.Column`, which is represented in a mapping as
    an instance of :class:`.ColumnProperty`,
    and a reference to another class produced by :func:`_orm.relationship`,
    represented in the mapping as an instance of
    :class:`.Relationship`.

    )�_configure_started�_configure_finishedr�r��parentr��info�docr�r�rR�_cache_key_traversalNTzPropComparator[_T]�
comparatorrm�Mapper[Any]Frp�_links_to_entityr�r�rPr�c��iS)a�Info dictionary associated with the object, allowing user-defined
        data to be associated with this :class:`.InspectionAttr`.

        The dictionary is generated when first accessed.  Alternatively,
        it can be specified as a constructor argument to the
        :func:`.column_property`, :func:`_orm.relationship`, or
        :func:`.composite`
        functions.

        .. seealso::

            :attr:`.QueryableAttribute.info`

            :attr:`.SchemaItem.info`

        r\r}s rd�_memoized_attr_infoz"MapperProperty._memoized_attr_info�s	��"�	rcc��y)aCalled by Query for the purposes of constructing a SQL statement.

        Each MapperProperty associated with the target mapper processes the
        statement referenced by the query context, adding columns and/or
        criterion as appropriate.

        Nr\)r~�context�query_entity�path�adapter�kwargss      rd�setupzMapperProperty.setup�r�rcc��y)zcProduce row processing functions and append to the given
        set of populators lists.

        Nr\)r~r�r�r��mapper�resultr��
populatorss        rd�create_row_processorz#MapperProperty.create_row_processor�r�rcc��td�S)a�Iterate through instances related to the given instance for
        a particular 'cascade', starting with this MapperProperty.

        Return an iterator3-tuples (instance, mapper, state).

        Note that the 'cascade' collection on this MapperProperty is
        checked first for the given type before cascade_iterator is called.

        This method typically only applies to Relationship.

        r\)�iter)r~�type_�state�dict_�visited_states�halt_ons      rd�cascade_iteratorzMapperProperty.cascade_iterator�s
��,�B�x�rcc��||_y)z�Set the parent mapper that references this MapperProperty.

        This method is overridden by some subclasses to perform extra
        setup when the mapper is first known.

        N)r�)r~r�r�s   rd�
set_parentzMapperProperty.set_parents����rcc��y)aIHook called by the Mapper to the property to initiate
        instrumentation of the class attribute managed by this
        MapperProperty.

        The MapperProperty here will typically call out to the
        attributes module to set up an InstrumentedAttribute.

        This step is the first of two steps to set up an InstrumentedAttribute,
        and is called early in the mapper setup process.

        The second step is typically the init_class_attribute step,
        called from StrategizedProperty via the post_instrument_class()
        hook.  This step assigns additional state to the InstrumentedAttribute
        (specifically the "impl") which has been determined after the
        MapperProperty has determined what kind of persistence
        management it needs to do (e.g. scalar, object, collection, etc).

        Nr\�r~r�s  rd�instrument_classzMapperProperty.instrument_classr�rcc��d|_d|_|rt}nt}|r||k7rd|_||_yd|_||_y)NFT)r�r��#_DEFAULT_READONLY_ATTRIBUTE_OPTIONS�_DEFAULT_ATTRIBUTE_OPTIONSr�r�)r~�attribute_options�_assume_readonly_dc_attributes�
default_attrss    rd�__init__zMapperProperty.__init__1sL��
#(���#(�� �)�?�M�6�M��!2�m�!C�,0�D�)�&7�D�#�,1�D�)�&3�D�#rcc�@�d|_|j�d|_y)z�Called after all mappers are created to assemble
        relationships between mappers and perform other post-mapper-creation
        initialization steps.


        TN)r��do_initr�r}s rdr�zMapperProperty.initEs��#'�������#'�� rcc�V�t|jj|j�S)a�Return the class-bound descriptor corresponding to this
        :class:`.MapperProperty`.

        This is basically a ``getattr()`` call::

            return getattr(self.parent.class_, self.key)

        I.e. if this :class:`.MapperProperty` were named ``addresses``,
        and the class to which it is mapped is ``User``, this sequence
        is possible::

            >>> from sqlalchemy import inspect
            >>> mapper = inspect(User)
            >>> addresses_property = mapper.attrs.addresses
            >>> addresses_property.class_attribute is User.addresses
            True
            >>> User.addresses.property is addresses_property
            True


        )�getattrr��class_r�r}s rd�class_attributezMapperProperty.class_attributePs��0�t�{�{�)�)�4�8�8�4�4rcc��y)z�Perform subclass-specific initialization post-mapper-creation
        steps.

        This is a template method called by the ``MapperProperty``
        object's init() method.

        Nr\r}s rdr�zMapperProperty.do_initjr�rcc��y)aPerform instrumentation adjustments that need to occur
        after init() has completed.

        The given Mapper is the Mapper invoking the operation, which
        may not be the same Mapper as self.parent in an inheritance
        scenario; however, Mapper will always at least be a sub-mapper of
        self.parent.

        This method is typically used by StrategizedProperty, which delegates
        it to LoaderStrategy.init_class_attribute() to perform final setup
        on the class-bound InstrumentedAttribute.

        Nr\r�s  rd�post_instrument_classz$MapperProperty.post_instrument_classsr�rcc	��y)zoMerge the attribute represented by this ``MapperProperty``
        from source to destination object.

        Nr\)	r~�session�source_state�source_dict�
dest_state�	dest_dict�load�
_recursive�_resolve_conflict_maps	         rd�mergezMapperProperty.merge�r�rcc�b�d|jjt|�t|dd�fzS)Nz<%s at 0x%x; %s>r�zno key)�	__class__r^�idr�r}s rd�__repr__zMapperProperty.__repr__�s4��!��N�N�#�#��t�H��D�%��*�%
�
�	
rc�r�rP�r�r?r�r>r�rEr��Optional[ORMAdapter]r�rr�r��r�r?r�r>r�rEr�r�r��Result[Any]r�r
r�rCr�r�rx)r�rmr��InstanceState[Any]r�r9r�zSet[InstanceState[Any]]r�z.Optional[Callable[[InstanceState[Any]], bool]]r�zGIterator[Tuple[object, Mapper[Any], InstanceState[Any], _InstanceDict]])r�r�r�rpr�r��r�r�r�r��NF)r�zOptional[_AttributeOptions]r�rpr�r��r�r�)r�zInstrumentedAttribute[_T])r�rGr�r
r�r9r�r
r�r9rrprzDict[Any, object]rz#Dict[_IdentityKeyType[Any], object]r�r�r�)r^r_r`r�rar-�ExtendedInternalTraversal�dp_has_cache_key�	dp_stringr�rtr�cascade�is_property�_is_relationshipr�r�r�r�r�r�r�r�r�r�r�r�rrr\rcrdr�r�ws:��	�	�I�
�8�5�5�F�F�G�	��2�2�<�<�=�4��0��
����K��
#�"�C�

�H�!���6������
��'�
�O�� �&� ��$��%�	�
&���
�
�� 
� �
�$�
�%�	
�
�
��

�&�
�#�
�
�
�*CG�
���"���	�
0��@�
�
��0��,:>�/4�4�6�4�)-�4�
�	4�(	(��5��5�2�
����)��#�	�
'��!�
���&�� C��
�� 
rcr�c�X�eZdZUdZdZdZded<ded<ded	<	d					dd�Zejdd��Z
d d
�Z				d!d�Z				d"d�Z
ejd#d��Z	d					d$d�Zejd%d��Zejd&d��Zed'd��Zed(d��Zed)d��Zeej2e�Zeej2e�Zeej2e�Zej<r								d*d�Z								d*d�Z d+d�Z!				d,d�Z"	d					d-d�Z#	d					d-d�Z$y
).�PropComparatora&Defines SQL operations for ORM mapped attributes.

    SQLAlchemy allows for operators to
    be redefined at both the Core and ORM level.  :class:`.PropComparator`
    is the base class of operator redefinition for ORM-level operations,
    including those of :class:`.ColumnProperty`,
    :class:`.Relationship`, and :class:`.Composite`.

    User-defined subclasses of :class:`.PropComparator` may be created. The
    built-in Python comparison and math operator methods, such as
    :meth:`.operators.ColumnOperators.__eq__`,
    :meth:`.operators.ColumnOperators.__lt__`, and
    :meth:`.operators.ColumnOperators.__add__`, can be overridden to provide
    new operator behavior. The custom :class:`.PropComparator` is passed to
    the :class:`.MapperProperty` instance via the ``comparator_factory``
    argument. In each case,
    the appropriate subclass of :class:`.PropComparator` should be used::

        # definition of custom PropComparator subclasses

        from sqlalchemy.orm.properties import (
            ColumnProperty,
            Composite,
            Relationship,
        )


        class MyColumnComparator(ColumnProperty.Comparator):
            def __eq__(self, other):
                return self.__clause_element__() == other


        class MyRelationshipComparator(Relationship.Comparator):
            def any(self, expression):
                "define the 'any' operation"
                # ...


        class MyCompositeComparator(Composite.Comparator):
            def __gt__(self, other):
                "redefine the 'greater than' operation"

                return sql.and_(
                    *[
                        a > b
                        for a, b in zip(
                            self.__clause_element__().clauses,
                            other.__composite_values__(),
                        )
                    ]
                )


        # application of custom PropComparator subclasses

        from sqlalchemy.orm import column_property, relationship, composite
        from sqlalchemy import Column, String


        class SomeMappedClass(Base):
            some_column = column_property(
                Column("some_column", String),
                comparator_factory=MyColumnComparator,
            )

            some_relationship = relationship(
                SomeOtherClass, comparator_factory=MyRelationshipComparator
            )

            some_composite = composite(
                Column("a", String),
                Column("b", String),
                comparator_factory=MyCompositeComparator,
            )

    Note that for column-level operator redefinition, it's usually
    simpler to define the operators at the Core level, using the
    :attr:`.TypeEngine.comparator_factory` attribute.  See
    :ref:`types_operators` for more detail.

    .. seealso::

        :class:`.ColumnProperty.Comparator`

        :class:`.Relationship.Comparator`

        :class:`.Composite.Comparator`

        :class:`.ColumnOperators`

        :ref:`types_operators`

        :attr:`.TypeEngine.comparator_factory`

    ��prop�
_parententity�_adapt_to_entity�orm_prop_comparator�_InternalEntityType[Any]r�Optional[AliasedInsp[Any]]rz,RODescriptorReference[MapperProperty[_T_co]]rNc�6�||_|xs||_||_yrxr)r~r�parentmapper�adapt_to_entitys    rdr�zPropComparator.__init__s ����	�,�<���� /��rcc��|jS)z�Return the :class:`.MapperProperty` associated with this
        :class:`.PropComparator`.


        Return values here will commonly be instances of
        :class:`.ColumnProperty` or :class:`.Relationship`.


        )rr}s rdr�zPropComparator.propertys���y�y�rcc��td|z��)Nz%rr�r}s rd�__clause_element__z!PropComparator.__clause_element__s��!�$��+�.�.rcc�<�td|j��|fgS)z�Receive a SQL expression that represents a value in the SET
        clause of an UPDATE statement.

        Return a tuple that can be passed to a :class:`_expression.Update`
        construct.

        rO)rr%)r~�values  rd�_bulk_update_tuplesz"PropComparator._bulk_update_tupless#���*�D�,C�,C�,E�F��N�O�Orcc�P�|j|j|j|�S)z�Return a copy of this PropComparator which will use the given
        :class:`.AliasedInsp` to produce corresponding expressions.
        )rrr)r~r"s  rdr"zPropComparator.adapt_to_entity+s!���~�~�d�i�i��);�);�_�M�Mrcc�.�|jjS)zZlegacy; this is renamed to _parententity to be
        compatible with QueryableAttribute.)rr�r}s rd�
_parentmapperzPropComparator._parentmapper3s���!�!�(�(�(rcc�P�|jjj|fi|��Srx)rr��_criterion_exists�r~�	criterionr�s   rdr-z PropComparator._criterion_exists9s&��
6�t�y�y�#�#�5�5�i�J�6�J�Jrcc�H�|j�y|jjS)zrProduce a callable that adapts column expressions
        to suit an aliased version of this comparator.

        N)r�_orm_adapt_elementr}s rdr�zPropComparator.adapter@s%��� � �(���(�(�;�;�;rcc�.�|jjSrx)rr�r}s rdr�zPropComparator.infoKs���y�y�~�~�rcc�(�|j|fi|��Srx)�any)�a�br�s   rd�_any_opzPropComparator._any_opOs���q�u�u�Q�!�&�!�!rcc�(�|j|fi|��Srx)�has)�left�otherr�s   rd�_has_opzPropComparator._has_opSs���t�x�x��(��(�(rcc�$�|j|�Srx)�of_type)r5r�s  rd�_of_type_opzPropComparator._of_type_opWs���y�y�� � rcc��yrxr\�r~�opr;r�s    rd�operatezPropComparator.operatea���!$rcc��yrxr\rAs    rd�reverse_operatezPropComparator.reverse_operateerDrcc�B�|jtj|�S)a�Redefine this object in terms of a polymorphic subclass,
        :func:`_orm.with_polymorphic` construct, or :func:`_orm.aliased`
        construct.

        Returns a new PropComparator from which further criterion can be
        evaluated.

        e.g.::

            query.join(Company.employees.of_type(Engineer)).filter(
                Engineer.name == "foo"
            )

        :param \class_: a class or mapper indicating that criterion will be
            against this specific subclass.

        .. seealso::

            :ref:`orm_queryguide_joining_relationships_aliased` - in the
            :ref:`queryguide_toplevel`

            :ref:`inheritance_of_type`

        )rCr�
of_type_op)r~r�s  rdr>zPropComparator.of_typeis��4�|�|�N�5�5�v�>�>rcc�D�|jtjg|���S)a?Add additional criteria to the ON clause that's represented by this
        relationship attribute.

        E.g.::


            stmt = select(User).join(
                User.addresses.and_(Address.email_address != "foo")
            )

            stmt = select(User).options(
                joinedload(User.addresses.and_(Address.email_address != "foo"))
            )

        .. versionadded:: 1.4

        .. seealso::

            :ref:`orm_queryguide_join_on_augmented`

            :ref:`loader_option_criteria`

            :func:`.with_loader_criteria`

        )rCr+�and_)r~�criterias  rdrJzPropComparator.and_�s��8�t�|�|�I�N�N�6�X�6�6rcc�F�|jtj|fi|��S)aReturn a SQL expression representing true if this element
        references a member which meets the given criterion.

        The usual implementation of ``any()`` is
        :meth:`.Relationship.Comparator.any`.

        :param criterion: an optional ClauseElement formulated against the
          member class' table or attributes.

        :param \**kwargs: key/value pairs corresponding to member class
          attribute names which will be compared via equality to the
          corresponding values.

        )rCr�any_opr.s   rdr4zPropComparator.any��"��(�t�|�|�N�1�1�9�G��G�Grcc�F�|jtj|fi|��S)aReturn a SQL expression representing true if this element
        references a member which meets the given criterion.

        The usual implementation of ``has()`` is
        :meth:`.Relationship.Comparator.has`.

        :param criterion: an optional ClauseElement formulated against the
          member class' table or attributes.

        :param \**kwargs: key/value pairs corresponding to member class
          attribute names which will be compared via equality to the
          corresponding values.

        )rCr�has_opr.s   rdr9zPropComparator.has�rNrcrx)rzMapperProperty[_T]r!rr"r)r�zMapperProperty[_T_co])r�zroles.ColumnsClauseRole)r'rr�z(Sequence[Tuple[_DMLColumnArgument, Any]])r"zAliasedInsp[Any]r��PropComparator[_T_co])r�r�)r/�)Optional[_ColumnExpressionArgument[bool]]r�rr��ColumnElement[Any])r�zOptional[_ORMAdapterProto]r)r5rr6rr�rr�r)r:rr;rr�rr�r)r5rr�rr�r)rBrQr;rr�rr�rS)r�z_EntityType[Any]r�rQ)rKz_ColumnExpressionArgument[bool]r�zPropComparator[bool])r/rRr�rr�zColumnElement[bool])%r^r_r`r�ra�__visit_name__rtr�r*�non_memoized_propertyr�r%r(r"�ro_non_memoized_propertyr+r-r�r��staticmethodr7r<r?rr+rQrMrPrH�typingrrCrFr>rJr4r9r\rcrdrr�sP��^�@<�I�*�N�+�+�0�0�
6�6�7;�	0� �0�/�0�4�	0�
���
� �
�/�P��P�	1�P�N�/�N�	�N�
�"�"�)�#�)�@D�K�<�K��K�
�	K�
�"�"�<�#�<�
�"�"��#���"��"��)��)��!��!��)�(�(�'�
2�F�
�)�(�(�'�
2�F��i�,�,�k�:�J�
���	%�"�	%�,/�	%�;>�	%�
�	%�	%�"�	%�+.�	%�:=�	%�
�	%�?�87�8�7�	�7�@@D�H�<�H��H�
�	H�0@D�H�<�H��H�
�	Hrcrc��eZdZUdZdZdZded<ded<ded	<dd
�Z		dd�Z						dd�Z	dd
�Z
												dd�Z																dd�Zdd�Z
dd�Zej e�Zded<edd��Ze						d d��Zy)!�StrategizedPropertya�A MapperProperty which uses selectable strategies to affect
    loading behavior.

    There is a single strategy selected by default.  Alternate
    strategies can be selected at Query time through the usage of
    ``StrategizedOption`` objects via the Query.options() method.

    The mechanics of StrategizedProperty are used for every Query
    invocation for every mapped attribute participating in that Query,
    to determine first how the attribute will be rendered in SQL
    and secondly how the attribute will retrieve a value from a result
    row and apply it to a mapped object.  The routines here are very
    performance-critical.

    )�_strategies�strategy�_wildcard_token�_default_path_loader_key�strategy_keyTz
ClassVar[str]�strategy_wildcard_key�_StrategyKeyr_z"Dict[_StrategyKey, LoaderStrategy]r[c�B�|j�dtj��fS)N�:)r`r�_WILDCARD_TOKENr}s rd�_memoized_attr__wildcard_tokenz2StrategizedProperty._memoized_attr__wildcard_token�s(���)�)�*�!�M�,I�,I�+J�K�
�	
rcc�F�d|j�dtj��ffS)N�loaderrc)r`r�_DEFAULT_TOKENr}s rd�'_memoized_attr__default_path_loader_keyz;StrategizedProperty._memoized_attr__default_path_loader_key�s0��
��*�*�+�1�]�-I�-I�,J�
K�M�
�	
rcc��d}||}|j|j|jfD]"}||jvs�|j|}|S|Srx)�_loader_key�_wildcard_path_loader_keyr^�
attributes)r~r�r�r�search_path�path_keys      rd�_get_context_loaderz'StrategizedProperty._get_context_loader�sl��(,���4�j��

�#�#��1�1��0�0�
�H�
�7�-�-�-��)�)�(�3�����!
� �rcc��	|j|S#t$rYnwxYw|j|g|���}|||�x|j|<}|Srx)r[�KeyError�_strategy_lookup)r~r�ryr\s    rd�
_get_strategyz!StrategizedProperty._get_strategyse��	��#�#�C�(�(���	��	��$�d�#�#�D�/�3�/��,/�t�S�>�9��������s��	�c���|j||�}|r(|jr|j|j�}n|j}|j|||||fi|��yrx)rpr\rt�setup_query)r~r�r�r�r�r�rg�strats        rdr�zStrategizedProperty.setup%s_���)�)�'�4�8���f�o�o��&�&�v���7�E��M�M�E������\�4���	
�<B�	
rcc
���|j||�}|r(|jr|j|j�}	n|j}	|	j||||||||�yrx)rpr\rtr�)
r~r�r�r�r�r�r�r�rgrws
          rdr�z(StrategizedProperty.create_row_processor6sb���)�)�'�4�8���f�o�o��&�&�v���7�E��M�M�E�
�"�"���������		
rcc�R�i|_|j|j�|_yrx)r[rtr_r\r}s rdr�zStrategizedProperty.do_initPs"������*�*�4�+<�+<�=��
rcc��|jjsB|jj|j�s|j
j
|�yyyrx)r��non_primary�
class_manager�_attr_has_implr�r\�init_class_attributer�s  rdr�z)StrategizedProperty.post_instrument_classTsD�����'�'��(�(�7�7����A��M�M�.�.�v�6�B�(rcz\collections.defaultdict[Type[MapperProperty[Any]], Dict[_StrategyKey, Type[LoaderStrategy]]]�_all_strategiesc����d��fd�}|S)Nc����d|jvrg|_tt�j	���}|�j
�|<|jj
|�|S)N�_strategy_keys)�__dict__r��tuple�sorted�itemsr�append)�dec_clsr�ryr�s  ��rd�decoratez2StrategizedProperty.strategy_for.<locals>.decorateas^��� �w�'7�'7�7�)+��&���r�x�x�z�*�+�C�,3�C����$�S�)��"�"�)�)�#�.��Nrc)r�rXr�rXr\)ryr�r�s`` rd�strategy_forz StrategizedProperty.strategy_for_s���	��rcc��|jj|jD]?}||jvs�trt|t�sJ�|j|}	||cS|jj�D]\}}||vs�|}||}nd}d}tj|||||��#t$rY��wxYwrx)r��_with_polymorphic_mappers�__mro__rr�
issubclassr�rrr��orm_exc�LoaderStrategyException)	ry�requesting_propertyr��prop_cls�
strategies�
property_type�strats�intended_property_type�actual_strategys	         rdrsz$StrategizedProperty._strategy_lookupms���	�"�"�<�<����H��3�.�.�.� �%�h��?�?�?� �0�0��:�
��%�c�?�*�
$�&)�%8�%8�%>�%>�%@�!�M�6��f�}�)6�&�"(��+���	&A�&*�"�"�O��-�-���"���
�	
�� ����s�B1�1	B=�<B=N)r�z
Tuple[str])r�zTuple[str, Tuple[str]])r�r?r�rEr��Optional[_LoadElement])r�rar��LoaderStrategyr	rrr)r�rr�zCallable[[_TLS], _TLS])r��MapperProperty[Any]r�rr�rY)r^r_r`r�ra�
inherit_cachertrerirprtr�r�r�r��collections�defaultdict�dictrr�r�rsr\rcrdrZrZ�sX��� �I��M�(�(���3�3�
�

�	�
��&��.D��	��6�
� �
�$�
�%�	
�
&�
��

�
�
�"
� �
�$�
�%�	
�
�
��

�&�
�#�
�
�
�4>�7�	 �����%���&������
�"5�
�=@�
�	�
��
rcrZc�F�eZdZdZdZdZdZ	dZdZdZ	dZ
dZ						dd�Zy)�	ORMOptiona�Base class for option objects that are passed to ORM queries.

    These options may be consumed by :meth:`.Query.options`,
    :meth:`.Select.options`, or in a more general sense by any
    :meth:`.Executable.options` method.   They are interpreted at
    statement compile time or execution time in modern use.  The
    deprecated :class:`.MapperOption` is consumed at ORM query construction
    time.

    .. versionadded:: 1.4

    r\Fc��|�|S|S)a�adapt this option to the "uncached" version of itself in a
        loader strategy context.

        given "self" which is an option from a cached query, as well as the
        corresponding option from the uncached version of the same query,
        return the option we should use in a new query, in the context of a
        loader strategy being asked to load related rows on behalf of that
        cached query, which is assumed to be building a new query based on
        entities passed to us from the cached query.

        Currently this routine chooses between "self" and "uncached" without
        manufacturing anything new. If the option is itself a loader strategy
        option which has a path, that path needs to match to the entities being
        passed to us by the cached query, so the :class:`_orm.Load` subclass
        overrides this to return "self". For all other options, we return the
        uncached form which may have changing state, such as a
        with_loader_criteria() option which will very often have new state.

        This routine could in the future involve
        generating a new option based on both inputs if use cases arise,
        such as if with_loader_criteria() needed to match up to
        ``AliasedClass`` instances given in the parent query.

        However, longer term it might be better to restructure things such that
        ``AliasedClass`` entities are always matched up on their cache key,
        instead of identity, in things like paths and such, so that this whole
        issue of "the uncached option does not match the entities" goes away.
        However this would make ``PathRegistry`` more complicated and difficult
        to debug as well as potentially less performant in that it would be
        hashing enormous cache keys rather than a simple AliasedInsp. UNLESS,
        we could get cache keys overall to be reliably hashed into something
        like an md5 key.

        .. versionadded:: 1.4.41

        r\)r~r��uncached_opts   rd�'_adapt_cached_option_to_uncached_optionz1ORMOption._adapt_cached_option_to_uncached_option�s��N�#����KrcN)r�r@r�r�r�r�)
r^r_r`r�ra�_is_legacy_option�propagate_to_loaders�_is_core�_is_user_defined�_is_compile_state�_is_criteria_option�_is_strategy_optionr�r\rcrdr�r��s[����I��� ����H���������*�#�*�3<�*�	�*rcr�c�4�eZdZdZdZdZdd�Z						dd�Zy)	�CompileStateOptiona�base for :class:`.ORMOption` classes that affect the compilation of
    a SQL query and therefore need to be part of the cache key.

    .. note::  :class:`.CompileStateOption` is generally non-public and
       should not be used as a base class for user-defined options; instead,
       use :class:`.UserDefinedOption`, which is easier to use as it does not
       interact with ORM compilation internals or caching.

    :class:`.CompileStateOption` defines an internal attribute
    ``_is_compile_state=True`` which has the effect of the ORM compilation
    routines for SELECT and other statements will call upon these options when
    a SQL string is being compiled. As such, these classes implement
    :class:`.HasCacheKey` and need to provide robust ``_cache_key_traversal``
    structures.

    The :class:`.CompileStateOption` class is used to implement the ORM
    :class:`.LoaderOption` and :class:`.CriteriaOption` classes.

    .. versionadded:: 1.4.28


    r\Tc��y)z�Apply a modification to a given :class:`.ORMCompileState`.

        This method is part of the implementation of a particular
        :class:`.CompileStateOption` and is only invoked internally
        when an ORM query is compiled.

        Nr\)r~�
compile_states  rd�process_compile_statez(CompileStateOption.process_compile_state�r�rcc��y)aqApply a modification to a given :class:`.ORMCompileState`,
        given entities that were replaced by with_only_columns() or
        with_entities().

        This method is part of the implementation of a particular
        :class:`.CompileStateOption` and is only invoked internally
        when an ORM query is compiled.

        .. versionadded:: 1.4.19

        Nr\�r~r��mapper_entitiess   rd�'process_compile_state_replaced_entitiesz:CompileStateOption.process_compile_state_replaced_entitiesr�rcN)r�r?r�r��r�r?r�zSequence[_MapperEntity]r�r�)r^r_r`r�rar�r�r�r\rcrdr�r��s:���.�I�����&��1��
�	rcr�c�(�eZdZdZdZ						dd�Zy)�LoaderOptionzhDescribe a loader modification to an ORM statement at compilation time.

    .. versionadded:: 1.4

    r\c�&�|j|�yrx)r�r�s   rdr�z4LoaderOption.process_compile_state_replaced_entitiess��
	
�"�"�=�1rcNr�)r^r_r`r�rar�r\rcrdr�r�s/����I�2�&�2�1�2�
�	2rcr�c� �eZdZdZdZdZdd�Zy)�CriteriaOptionztDescribe a WHERE criteria modification to an ORM statement at
    compilation time.

    .. versionadded:: 1.4

    r\Tc��y)z_update additional entity criteria options in the given
        attributes dictionary.

        Nr\)r~rms  rd�get_global_criteriaz"CriteriaOption.get_global_criteria3r�rcN)rmzDict[str, Any]r�r�)r^r_r`r�rar�r�r\rcrdr�r�'s����I���rcr�c�,�eZdZdZdZdZdZdZ	ddd�Zy)	�UserDefinedOptionz~Base class for a user-defined option that can be consumed from the
    :meth:`.SessionEvents.do_orm_execute` event hook.

    ��payloadFTNc��||_yrxr�)r~r�s  rdr�zUserDefinedOption.__init__Ms	����rcrx)r�r�)	r^r_r`r�rar�r�r�r�r\rcrdr�r�:s*���
�I����� ���rcr�z1.4aKThe :class:`.MapperOption class is deprecated and will be removed in a future release.   For modifications to queries on a per-execution basis, use the :class:`.UserDefinedOption` class to establish state within a :class:`.Query` or other Core statement, then use the :meth:`.SessionEvents.before_orm_execute` hook to consume them.)�constructorc�.�eZdZdZdZdZdZ	dd�Zdd�Zy)	�MapperOptionz"Describe a modification to a Queryr\TFc��y)z8Apply a modification to the given :class:`_query.Query`.Nr\�r~�querys  rd�
process_queryzMapperOption.process_queryir�rcc�&�|j|�y)aosame as process_query(), except that this option may not
        apply to the given query.

        This is typically applied during a lazy load or scalar refresh
        operation to propagate options stated in the original Query to the
        new Query being used for the load.  It occurs for those options that
        specify propagate_to_loaders=True.

        N)r�r�s  rd�process_query_conditionallyz(MapperOption.process_query_conditionallyls��	
���5�!rcN)r�z
Query[Any]r�r�)	r^r_r`r�rar�r�r�r�r\rcrdr�r�Qs(��-��I��� ���G�"rcr�c��eZdZUdZdZded<				dd�Zdd�Z														d
d�Z																		dd�Z	dd	�Z
y
)r�a�Describe the loading behavior of a StrategizedProperty object.

    The ``LoaderStrategy`` interacts with the querying process in three
    ways:

    * it controls the configuration of the ``InstrumentedAttribute``
      placed on a class to handle the behavior of the attribute.  this
      may involve setting up class-level callable functions to fire
      off a select operation when the attribute is first accessed
      (i.e. a lazy load)

    * it processes the ``QueryContext`` at statement construction time,
      where it can modify the SQL statement that is being produced.
      For example, simple column attributes will add their represented
      column to the list of selected columns, a joined eager loader
      may establish join clauses to add to the statement.

    * It produces "row processor" functions at result fetching time.
      These "row processor" functions populate a particular attribute
      on a particular mapped instance.

    )�parent_property�is_class_levelr�r�r_�
strategy_optszClassVar[List[_StrategyKey]]r�c��||_d|_|jj|_|jj|_||_t|�|_yr)r�r�r�r�r_r�r�)r~r�r_s   rdr�zLoaderStrategy.__init__�sO�� &���#����*�*�1�1����'�'�+�+���(���!�,�/��rcc��yrxr\r�s  rdr~z#LoaderStrategy.init_class_attribute�s��rcc��y)z�Establish column and other state for a given QueryContext.

        This method fulfills the contract specified by MapperProperty.setup().

        StrategizedProperty delegates its setup() method
        directly to this method.

        Nr\)r~r�r�r��loadoptr�r�s       rdrvzLoaderStrategy.setup_query�r�rcc	��y)aEstablish row processing functions for a given QueryContext.

        This method fulfills the contract specified by
        MapperProperty.create_row_processor().

        StrategizedProperty delegates its create_row_processor() method
        directly to this method.

        Nr\)	r~r�r�r�r�r�r�r�r�s	         rdr�z#LoaderStrategy.create_row_processor�r�rcc�,�t|j�Srx)rmr�r}s rd�__str__zLoaderStrategy.__str__�s���4�'�'�(�(rcN)r�r�r_rar)r�r?r�r>r�rEr�r�r�r
r�rr�r�)r�r?r�r>r�rEr�r�r�r�r�rr�r
r�rCr�r�r�)r^r_r`r�rartr�r~rvr�r�r\rcrdr�r�zs����.�I�1�0�0�)�0�9E�0�
��&��$��%�	�
(��&�
���
��$� ��$��%�	�
(���
���&��#��
��*)rcr�)�r��
__future__rr�r�rXrrrrrr	r
rrr
rrrrrrrr�rr�r�baserrrrrrrr r!r"r#r$r%r&r(r�r)r*�sqlr+r,r-�sql.baser.r/�
sql.cache_keyr0�
sql.operatorsr1�
sql.schemar2�sql.type_apir3r4�util.typingr5r6�_typingr7r8r9r:r;rmr<r=r�r>r?r@�decl_apirA�	decl_baserB�loadingrCr�rDrEr�rFr�rGr�rH�strategy_optionsrIrJrK�
engine.resultrL�sql._typingrMrNrOrPrQ�sql.visitorsrRrSrarTrVrX�
StatementRoler[�ColumnsClauseRole�TypedColumnsClauseRolerfrh�StrictFromClauseRolerjrlrvr�r�r�r�r�r��_self_inspects�
MemoizedSlotsr�rrZr�r�r�r�r��deprecated_clsr�r�r\rcrd�<module>r�sg��	�#���
���������������� �����6�.�&�&�2�:�*�(�"�&�.�(�@�"���������'�'�+��%�"�/�#�	���$�)�&�,�)�1��&�(�%�&�1�'��5�� �$�.�!� �&�7�4�0�'�,�5�1��S�#�X����T������s�d�3���v�3�4���u�*�*��K�	���U�9�9�"�=�K�0�!5�b�!9�0�
I��2�2�I�
2�9�2�)
�)
�Xi%�
�i%�X/�
�M�M�
�M�M�
�M�M�
�M�M�
�M�M�
�M�M�
�M�M���'8�	�
�M�M�
�M�M�
�M�M�
�M�M�
�M�M�
�M�M�'�#�#�#�.$�&�(8��(<�$�<���_
����R������_
��_
�D	���rH�%�e�,�g�e�n�o�rH��rH�j	|
�.��,�|
�~M� �M�`4��i�4�n2�%�2�"�'��&�	��.����	�F��	�"�9�"�	�"�>X)�X)rc

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic