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__/attributes.cpython-312.pyc

�

���gvi��	�dZddlmZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!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+dd'lm,Z,dd(lm-Z-dd)lm.Z.dd*lm/Z/dd+lm0Z0dd,lm1Z1dd-lm2Z2dd.lm3Z3dd/lm4Z4dd0lm5Z5dd1lm6Z6dd2lm7Z7dd3lm8Z8dd4lm9Z9dd5lm:Z:dd6lm;Z;dd7lm<Z<dd8lm=Z=dd9lm>Z>dd:lm?Z?dd;lm@Z@d<d=lmAZAd<dlmZd<d>lmBZBd<d?lmCZCd<d@lAmDZDd<dAlAmEZEd<dBlFmZGd<dClFmHZHd<dDlFmIZId<dElFmJZJd<dFlFmKZKd<dGlLmMZMd<dHlNmOZOd<dIlNmPZPd<dJlQmRZRd<dKlQmSZSd<dLlQmTZTer�ddMlmUZUddNlmVZVddOlmWZWddPlmXZXddQlmYZYddRlmZZZddSlm[Z[ddTlm\Z\ddUlm]Z]ddVl^m_Z_ddWl`maZaddXlCmbZbddYlcmdZdd<dZlemfZfd<d[lgmhZhd<d\lgmiZid<d]lgmjZjd<d^lgmkZkd<d_llmmZmd<d`lnmoZod<dalnmpZpd<dblqmrZrd<dclsmtZtedd�Zuedeedf�g�ZveeedheewfZxew�ZyeBj�Gdi�djeeve?evej�ej�eveJj�eJj�eGj�eH�jeC�jeE��Z�										d�dk�Z�Gdl�dme�ev�Z�e�j
df�n�Gdo�dpeM��Z�				d�dq�Z�eC�jdr�Z�eC�jds�Z�eC�jdt�Z�eC�jdu�Z�eC�jdv�Z�Gdw�dx�Z�e�Z�e�Z�Gdy�dz�Z�Gd{�d|e��Z�Gd}�d~e��Z�Gd�d��Z�er					d�d��Z�ne�j,d��Z�Gd��d�e�e��Z�								d�d��Z�eC�jd��Z�e�e�e8�e�e1�g�Z�Gd��d�e
�Z�e�d�d�d��Z�e9f							d�d��Z�e9f							d�d��Z�	d�									d�d��Z�dd��													d�d��Z�					d�																	d�d��Z�dd��											d�d��Z�d�d��Z�d�d��Z�								d�d��Z�d��Z�	d�									d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�y)�z�Defines instrumentation for class attributes and their interaction
with instances.

This module is usually not directly visible to user applications, but
defines a large part of the ORM's interactivity.


�)�annotationsN)�Any)�Callable)�cast)�ClassVar)�Dict)�Iterable)�List)�
NamedTuple)�Optional)�overload)�Sequence)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�collections)�exc)�
interfaces)�insp_is_aliased_class)�_DeclarativeMapped)�
ATTR_EMPTY)�ATTR_WAS_SET)�CALLABLES_OK)�DEFERRED_HISTORY_LOAD)�INCLUDE_PENDING_MUTATIONS)�INIT_OK)�
instance_dict)�instance_state)�instance_str)�LOAD_AGAINST_COMMITTED)�LoaderCallableStatus)�manager_of_class)�Mapped)�	NEVER_SET)�NO_AUTOFLUSH)�	NO_CHANGE)�NO_KEY)�NO_RAISE)�NO_VALUE)�NON_PERSISTENT_OK)�opt_manager_of_class)�PASSIVE_CLASS_MISMATCH)�PASSIVE_NO_FETCH)�PASSIVE_NO_FETCH_RELATED)�PASSIVE_NO_INITIALIZE)�PASSIVE_NO_RESULT)�PASSIVE_OFF)�PASSIVE_ONLY_PERSISTENT)�PASSIVE_RETURN_NO_VALUE)�PassiveFlag)�RELATED_OBJECT_OK)�SQL_OK)�SQLORMExpression)�	state_str�)�event)�
inspection)�util)�
dispatcher)�EventTarget)�base)�	cache_key)�	coercions)�roles)�visitors)�HasCacheKey)�_TraverseInternalsType)�InternalTraversal)�Literal)�Self)�	TypeGuard)�_EntityType)�_ExternalEntityType)�
_InstanceDict)�_InternalEntityType)�_LoaderCallable)�_O)�_AdaptedCollectionProtocol)�CollectionAdapter)�MapperProperty)�RelationshipProperty)�
InstanceState)�AliasedInsp)�WriteOnlyAttributeImpl)�	_Dispatch)�_ColumnExpressionArgument)�_DMLColumnArgument)�	_InfoType)�_PropagateAttrsType)�_AnnotationDict)�
ColumnElement)�Label)�OperatorType)�
FromClause�_T�_T_coT)�bound�	covariant�InstanceState[Any]c��eZdZUdZdZdZded<ded<ded	<d
ed<ded
<ded<ded<ded<ded<dZ			d3													d4d�Zd	e	jjfde	jjfde	jjfde	jjfgZd5d�Zed6d��Zef					d7d�Zed8d��Zd
ed<	ded <	d9d!�Zd:d"�Zed;d#��Zed<d$��Zd=d%�Zed>d&��Z				d?d'�Zd@d(�ZdAd)�Z				dBd*�ZdCd+�Z dDd,�Z!								dEd-�Z"								dEd.�Z#	dF					dGd/�Z$dHd0�Z%dId1�Z&dJd2�Z'y)K�QueryableAttributea�Base class for :term:`descriptor` objects that intercept
    attribute events on behalf of a :class:`.MapperProperty`
    object.  The actual :class:`.MapperProperty` is accessible
    via the :attr:`.QueryableAttribute.property`
    attribute.


    .. seealso::

        :class:`.InstrumentedAttribute`

        :class:`.MapperProperty`

        :attr:`_orm.Mapper.all_orm_descriptors`

        :attr:`_orm.Mapper.attrs`
    )�class_�key�impl�
comparator�property�parent�
expression�_of_type�_extra_criteria�_slots_dispatch�_propagate_attrs�_docTz%dispatcher[QueryableAttribute[_T_co]]�dispatch�_ExternalEntityType[Any]rk�strrl�_InternalEntityType[Any]�parententity�
AttributeImplrm� interfaces.PropComparator[_T_co]rn�"Optional[_InternalEntityType[Any]]rr�Tuple[ColumnElement[bool], ...]rs�
Optional[str]rv�orm_instrumented_attributeNc�x�||_||_|x|_|_||_|�J�||_||_||_d|_t|�}|rj|jD]Z}	||	vs�|jj|	|j�|	|jjs�Jd|j_
�\yy�NT)rkrl�
_parententityrprmrnrrrsrvr.�_basesrw�_update�_active_history)
�selfrkrlr{rnrm�of_type�extra_criteria�managerrBs
          �J/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/orm/attributes.py�__init__zQueryableAttribute.__init__�s���������+7�7���T�[���	��%�%�%�$�����
�-�����	�&�v�.��� �����$�;��M�M�)�)�$�s�)�*<�*<�=��C�y�)�)�9�9�8<��
�
�5�	'��r�c��t|j|jjj|j|jj
ffS�N)�_queryable_attribute_unreducerlr��mapperrk�entity�r�s r��
__reduce__zQueryableAttribute.__reduce__�sJ��
*�����"�"�)�)�0�0��"�"��"�"�)�)�	
�
�	
r�c�.�|jjSr�)rm�uses_objectsr�s r��_impl_uses_objectsz%QueryableAttribute._impl_uses_objects�s���y�y�%�%�%r�c�`�|jjt|�t|�|�Sr�)rm�get_historyr!r )r��instance�passives   r�r�zQueryableAttribute.get_historys,���y�y�$�$��8�$�m�H�&=�w�
�	
r�c�.�|jjS)a�Return the 'info' dictionary for the underlying SQL element.

        The behavior here is as follows:

        * If the attribute is a column-mapped property, i.e.
          :class:`.ColumnProperty`, which is mapped directly
          to a schema-level :class:`_schema.Column` object, this attribute
          will return the :attr:`.SchemaItem.info` dictionary associated
          with the core-level :class:`_schema.Column` object.

        * If the attribute is a :class:`.ColumnProperty` but is mapped to
          any other kind of SQL expression other than a
          :class:`_schema.Column`,
          the attribute will refer to the :attr:`.MapperProperty.info`
          dictionary associated directly with the :class:`.ColumnProperty`,
          assuming the SQL expression itself does not have its own ``.info``
          attribute (which should be the case, unless a user-defined SQL
          construct has defined one).

        * If the attribute refers to any other kind of
          :class:`.MapperProperty`, including :class:`.Relationship`,
          the attribute will refer to the :attr:`.MapperProperty.info`
          dictionary associated with that :class:`.MapperProperty`.

        * To access the :attr:`.MapperProperty.info` dictionary of the
          :class:`.MapperProperty` unconditionally, including for a
          :class:`.ColumnProperty` that's associated directly with a
          :class:`_schema.Column`, the attribute can be referred to using
          :attr:`.QueryableAttribute.property` attribute, as
          ``MyClass.someattribute.property.info``.

        .. seealso::

            :attr:`.SchemaItem.info`

            :attr:`.MapperProperty.info`

        )rn�infor�s r�r�zQueryableAttribute.info
s��P���#�#�#r�rp�ColumnElement[_T_co]rqc��|j}t|t�sJ�|jturd|i}n|j|j
|d�}|jj�}	trt|t�sJ�|j}||�S#t$r!}tjd|�d|���|�d}~wwxYw)N�entity_namespace)�	proxy_key�proxy_ownerr�zWhen interpreting attribute "z\" as a SQL expression, expected __clause_element__() to return a ClauseElement object, got: )�_entity_namespace�
isinstancerGrl�_UNKNOWN_ATTR_KEYr�rn�__clause_element__rr`�	_annotate�AttributeErrorr�InvalidRequestError)r�r�r�ce�anno�aes      r��_memoized_attr_expressionz,QueryableAttribute._memoized_attr_expressionGs��� �1�1���*�K�8�8�8��8�8�(�(�-�/?�@�K�"�X�X�#�1�1�$4��K��_�_�
/�
/�
1��	%��!�"�m�4�4�4��<�<�D���$�$���	��)�)�6:�2�?���	
��	�s�+$B�	C� B<�<Cc�F�tjd|jd��S)N�orm)�compile_state_plugin�plugin_subject)r?�
immutabledict�
_parentmapperr�s r��_memoized_attr__propagate_attrsz2QueryableAttribute._memoized_attr__propagate_attrsis(���!�!�(-�"&�"4�"4�
�
�	
r�c��|jSr�)r�r�s r�r�z$QueryableAttribute._entity_namespacets���!�!�!r�c�6�|j�jSr�)r��_annotationsr�s r�r�zQueryableAttribute._annotationsxs���&�&�(�5�5�5r�c��|jSr�)rqr�s r�r�z%QueryableAttribute.__clause_element__|s�����r�c�.�|jjSr�)rq�
_from_objectsr�s r�r�z QueryableAttribute._from_objectss�����,�,�,r�c�8�|jj|�S)z'Return setter tuples for a bulk UPDATE.)rn�_bulk_update_tuples�r��values  r�r�z&QueryableAttribute._bulk_update_tuples�s��
���2�2�5�9�9r�c��|jrJ�|j|j|j|j|j
j
|�|��S)N)rmrnr{)rr�	__class__r�rlrmrn�adapt_to_entity�r�r�s  r�r�z"QueryableAttribute.adapt_to_entity�sQ���=�=� � ��~�~��"�"��H�H�������6�6��G�(��
�	
r�c
���t|j|j|j|j|j
j
|�tj|�|j��S�N�rmrnr�r�)
rjrkrlr�rmrnr�r>�inspectrs)r�r�s  r�r�zQueryableAttribute.of_type�sV��!��K�K��H�H����������.�.�v�6��&�&�v�.��/�/�
�	
r�c
�t�tr&t|jtj�sJ�td�t
j|�D��}t|j|j|j|j|jj|�|j|j|z��S)Nc3�dK�|](}tjtj|����*y�wr�)rD�expectrE�WhereHavingRole)�.0�clauses  r��	<genexpr>z*QueryableAttribute.and_.<locals>.<genexpr>�s+����
�<��
���U�2�2�F�;�<�s�.0r�)rr�rnrV�
Comparator�tupler?�coerce_generator_argrjrkrlr�rm�and_rrrs)r��clauses�exprss   r�r�zQueryableAttribute.and_�s�����d�o�o�/C�/N�/N�O�O�O��
��3�3�G�<�
�
��
"��K�K��H�H�������+�t���+�+�U�3��M�M��/�/�%�7�
�	
r�c	��t|j|j|j|j|j
|j|j��Sr�)rjrkrlr�rmrnrrrs�r��kws  r��_clonezQueryableAttribute._clone�sD��!��K�K��H�H�����������M�M��/�/�
�	
r�c�@�|j�j|�Sr�)r��label)r��names  r�r�zQueryableAttribute.label�s���&�&�(�.�.�t�4�4r�c�.�||jg|��i|��Sr��rn�r��op�other�kwargss    r��operatezQueryableAttribute.operate�s���$�/�/�4�E�4�V�4�4r�c�*�|||jfi|��Sr�r�r�s    r��reverse_operatez"QueryableAttribute.reverse_operate�s���%����3�F�3�3r�c�@�|jj||��duS)N)�
optimisticF�rm�	hasparent)r��stater�s   r�r�zQueryableAttribute.hasparent�s#���y�y�"�"�5�Z�"�@��M�Mr�c�B�	tjj||�S#t$rYnwxYw	t	|j
|�S#t$rM}tdt
|�j�dt
|j
�j�d|�d|���|�d}~wwxYw)N�Neither � object nor � object associated with � has an attribute �r?�
MemoizedSlots�__getattr__r��getattrrn�type�__name__)r�rl�errs   r�r�zQueryableAttribute.__getattr__�s���	��%�%�1�1�$��<�<���	��	��	��4�?�?�C�0�0���
	� ���J�'�'�����)�2�2���
�	��	
��
	�s$�"�	.�.�A�	B�AB�Bc�L�|jj�d|j��S�N�.�rkr�rlr�s r��__str__zQueryableAttribute.__str__��"���+�+�&�&�'�q����
�3�3r�c�.�|jjSr��rnror�s r��_memoized_attr_propertyz*QueryableAttribute._memoized_attr_property�s�����'�'�'r�)NN�)rk�_ExternalEntityType[_O]rlryr{�_InternalEntityType[_O]rnr}rmzOptional[AttributeImpl]r�r~r�r)�returnr�r�bool)r�rr�r7r�History)rr])rzColumnElement[_T])rr^)rrz)rr_)rr�)rzList[FromClause])r�rrz(Sequence[Tuple[_DMLColumnArgument, Any]])r�zAliasedInsp[Any]rrK)r�z_EntityType[_T]r�QueryableAttribute[_T])r�z_ColumnExpressionArgument[bool]rzQueryableAttribute[bool])r�rrr)r�r�rzLabel[_T_co])r�rbr�rr�rrzColumnElement[Any]�F�r�rhr�rrr)rlryrr�rry)rzOptional[MapperProperty[Any]])(r��
__module__�__qualname__�__doc__�	__slots__�is_attribute�__annotations__�__visit_name__r�rF�ExtendedInternalTraversal�	dp_string�dp_multirI�dp_clauseelement_list�_cache_key_traversalr�ror�r4r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rjrj�su���$
�I��L�3�3�$�$�	�H�*�*�
��0�0�0�0�4�4�
��2�N�)-�6:�:<�$=�'�$=��$=�.�	$=�
5�$=�&�
$=�4�$=�8�$=�N
��2�2�<�<�=�	�(�<�<�E�E�F�	�X�7�7�@�@�A�	�H�6�6�L�L�M�	��
��&��&�5@�
��
�&1�
�	�
��'$��'$�R
%�$��%�$�� %�D	
��"��"��6��6���-��-�:��:�	1�:�
�	
�
�7�
�	!�
�*	
�5�5��5�(+�5�7:�5�	�5�
4��4�'*�4�69�4�	�4�=B�N�'�N�59�N�	
�N�
�(4�(r�rjc�V�t|�r|j|||�St||�Sr�)r�_get_from_serializedr�)rl�mapped_classr{r�s    r�r�r��s.���\�*��*�*�3��l�K�K��v�s�#�#r�c����eZdZdZdZdZ	ejdd��Zejd
d��Zejd�fd��Zdd�Z
dd�Ze						dd	��Z
edd
��Z
						dd�Z
�xZS)�InstrumentedAttributez�Class bound instrumented attribute which adds basic
    :term:`descriptor` methods.

    See :class:`.QueryableAttribute` for a description of most features.


    r�Tc��|jSr��rvr�s r�rzInstrumentedAttribute.__doc__s���y�y�r�c��||_yr�rr�s  r�rzInstrumentedAttribute.__doc__s	����	r�c���t�|�Sr�)�superr)�clsr�s �r�rzInstrumentedAttribute.__doc__s
����w��r�c�d�|jjt|�t|�|d�yr�)rm�setr!r )r�r�r�s   r��__set__zInstrumentedAttribute.__set__s%���	�	�
�
��8�$�m�H�&=�u�d�	
r�c�`�|jjt|�t|��yr�)rm�deleter!r )r�r�s  r��
__delete__z InstrumentedAttribute.__delete__s ���	�	�����1�=��3J�Kr�c��yr�r��r�r��owners   r��__get__zInstrumentedAttribute.__get__ s��(+r�c��yr�r�r(s   r�r*zInstrumentedAttribute.__get__%s��>Ar�c�$�|�|St|�}|jjr|j|vr||jS	t	|�}|jj||�S#t
$r}t
j|�|�d}~wwxYwr�)	r rm�supports_populationrlr!r��orm_exc�UnmappedInstanceError�get)r�r�r)�dict_r�r�s      r�r*zInstrumentedAttribute.__get__(s������K��h�'���9�9�(�(�T�X�X��->�����?�"�
G�&�x�0���9�9�=�=���.�.��"�
G��3�3�H�=�3�F��
G�s�A+�+	B�4B
�
B)rr�)r�r�r�None)r��objectr�rrr2�r�r3rr2)r�r2r)rrzInstrumentedAttribute[_T_co])r�r3r)rrre)r��Optional[object]r)rrz*Union[InstrumentedAttribute[_T_co], _T_co])r�r
rrr
�
inherit_cacher?�rw_hybridproperty�setter�
classlevelr#r&r
r*�
__classcell__�r�s@r�rr�s������I��M��
������
�^�^����
������
�
L��+��+�%(�+�	%�+��+��A��A�/�(�/�14�/�	3�/r�r)�frozenc�p�eZdZUdejfgZded<dZded<dZded<dZ	ded	<e
d
��Zy)�AdHocHasEntityNamespacer�z ClassVar[_TraverseInternalsType]�_traverse_internals)r�rzFzClassVar[bool]�	is_mapper�is_aliased_classc�.�|jjSr�)r�r�r�s r�r�z(AdHocHasEntityNamespace.entity_namespaceEs���%�%�6�6�6r�N)r�r
rrI�dp_has_cache_keyr?rr
r@rAror�r�r�r�r>r>9sW��
�/�@�@�A�=��9��
'�I�/�/� %�I�~�%�',��n�,�
�7��7r�r>c���G�fd�dtt�}t��jdz|_t	j
|t��d���|S)z�Create an QueryableAttribute / user descriptor hybrid.

    Returns a new QueryableAttribute type that delegates descriptor
    behavior and getattr() to the given descriptor.
    c� ��eZdZdZdZ			dd�Zed��Zed��ZdZ	de
jjfd	e
jjfgZed
��Zed��Zed��Zej$d
��Zd�Zd�Zd�Zdd�Z�fd�Zy)�'create_proxied_attribute.<locals>.Proxyz�Presents the :class:`.QueryableAttribute` interface as a
        proxy on top of a Python descriptor / :class:`.PropComparator`
        combination.

        r�Nc�t�||_||_||_||_||_||_|x|_|_yr�)rkrl�
descriptor�original_property�_comparator�_adapt_to_entityrvr)r�rkrlrHrnr��docrIs        r�r�z0create_proxied_attribute.<locals>.Proxy.__init__cs?��!�D�K��D�H�(�D�O�%6�D�"�)�D��$3�D�!�'*�*�D�I��r�c�D�tj|jd��S�NF)�raiseerr�r>r�rkr�s r�r�z5create_proxied_attribute.<locals>.Proxy._parententityu����%�%�d�k�k�E�B�Br�c�D�tj|jd��SrNrPr�s r�rpz.create_proxied_attribute.<locals>.Proxy.parentyrQr�Trlr�c��|jduxr4t|j|j�jj
Sr�)rIr�rkrlrmr�r�s r�r�z:create_proxied_attribute.<locals>.Proxy._impl_uses_objects�s;���&�&�d�2�E��D�K�K����2�7�7�D�D�
r�c��t|jd�r|jjSt|j�S)Nr�)�hasattrrJr�r>r�s r�r�z9create_proxied_attribute.<locals>.Proxy._entity_namespace�s7���t�'�'��9��'�'�5�5�5�/�t�/A�/A�B�Br�c�.�|jjSr�r�r�s r�roz0create_proxied_attribute.<locals>.Proxy.property�s���?�?�+�+�+r�c���t|j�r|j�|_|jr*|jj|j�|_|jSr�)�callablerJrKr�r�s r�rnz2create_proxied_attribute.<locals>.Proxy.comparator�sZ����(�(�)�#'�#3�#3�#5�� ��$�$�#'�#3�#3�#C�#C��)�)�$�� ��#�#�#r�c�|�|j|j|j|j|j|�Sr�)r�r�rlrHrJr�s  r�r�z7create_proxied_attribute.<locals>.Proxy.adapt_to_entity�s6���>�>��&�&�������� � ���
r�c��|j|j|j|j|j|j
|j��S)N)r�rI)r�rkrlrHrJrKrIr�s  r�r�z.create_proxied_attribute.<locals>.Proxy._clone�sH���>�>����������� � � $� 5� 5�"&�"8�"8�
"��
r�c�b�|jj||�}||jur|�|S|Sr�)rHr*)r�r�r)�retvals    r�r*z/create_proxied_attribute.<locals>.Proxy.__get__�s5���_�_�,�,�X�u�=�F�����(�X�-=����
r�c�L�|jj�d|j��Sr�r�r�s r�r�z/create_proxied_attribute.<locals>.Proxy.__str__�s"���k�k�*�*�+�1�T�X�X�J�7�7r�c���	tjj||�S#t$rYnwxYw	t	�|�S#t$r�}|dk(rtd�|�	|j
}	t	||�cYd}~S#t$rC}tdt
��j�dt
|�j�d|�d|���|�d}~wwxYw#t$r-}tdt
��j�d|�d|���|�d}~wwxYwd}~wwxYw)zNDelegate __getattr__ to the original descriptor and/or
            comparator.rnNr�r�r�r�z; object nor unconfigured comparator object associated with r�)r��	attributer�rn�err3�err2rHs      �r�r�z3create_proxied_attribute.<locals>.Proxy.__getattr__�s���
��)�)�5�5�d�I�F�F��!�
��
��
$��z�9�5�5��!�
$���,�(��6�C�?�$�!%���J�$�&�z�9�=�=��)�
$�,�!%�Z� 0� 9� 9� $�Z� 0� 9� 9� $� )�
�	� $�	$��
$��&� �(� �
�+�4�4�d�I�G�� �	 �� ��

$�sc�#�	/�/�?�	D�D�C�'A8�2D�8	C�>B?�?C�D�	C=�(C8�8C=�=D�D)NNNr	)r�r
rrrsr�ror�rp�_is_internal_proxyrFrrrrr�r�r?�memoized_propertyrnr�r�r*r�r�)rHs�r��ProxyrFVs����	���!��"�	+�$
�	C�
�	C�
�	C�
�	C�"���H�6�6�@�@�A�
�h�@�@�I�I�J� 
��

�	�
�	�
�	C�
�	C�
�	,�
�	,�
�	�	�	$�
 �	$�	�	�	�	8�(	$r�rdrH)r��
from_instance)rjrr�r�r?�monkeypatch_proxied_specials)rHrds` r��create_proxied_attributergJsT���T$�"�3�'�T$�l�*�%�.�.��8�E�N��%�%�
�t�J��l�*���Lr��REMOVE�APPEND�REPLACE�BULK_REPLACE�MODIFIEDc�8�eZdZdZdZdd�Zd�Zed��Zd�Z	y)	�AttributeEventTokena�A token propagated throughout the course of a chain of attribute
    events.

    Serves as an indicator of the source of the event and also provides
    a means of controlling propagation across a chain of attribute
    operations.

    The :class:`.Event` object is sent as the ``initiator`` argument
    when dealing with events such as :meth:`.AttributeEvents.append`,
    :meth:`.AttributeEvents.set`,
    and :meth:`.AttributeEvents.remove`.

    The :class:`.Event` object is currently interpreted by the backref
    event handlers, and is used to control the propagation of operations
    across two mutually-dependent attributes.

    .. versionchanged:: 2.0  Changed the name from ``AttributeEvent``
       to ``AttributeEventToken``.

    :attribute impl: The :class:`.AttributeImpl` which is the current event
     initiator.

    :attribute op: The symbol :attr:`.OP_APPEND`, :attr:`.OP_REMOVE`,
     :attr:`.OP_REPLACE`, or :attr:`.OP_BULK_REPLACE`, indicating the
     source operation.

    �rmr��parent_tokenc�V�||_||_|jj|_yr�ro)r��attribute_implr�s   r�r�zAttributeEventToken.__init__s"��"��	���� �I�I�2�2��r�c��t|t�xr3|j|juxr|j|jk(Sr�)r�rnrmr�)r�r�s  r��__eq__zAttributeEventToken.__eq__s<���u�1�2�
$��
�
�d�i�i�'�
$����D�G�G�#�	
r�c�.�|jjSr�)rmrlr�s r�rlzAttributeEventToken.key&s���y�y�}�}�r�c�8�|jj|�Sr�r�)r�r�s  r�r�zAttributeEventToken.hasparent*s���y�y�"�"�5�)�)r�N)rrr|r�zutil.symbol)
r�r
rrr
r�rtrorlr�r�r�r�rnrn�s1���8-�I�3�

�����*r�rnc�<�eZdZUdZded<ded<ded<ded<ded<dZd	ed
<d	ed<d	ed<							d!																							d"d�ZdZd#d�Zd�Z	d�Z
ee	e
�Z	d$					d%d�Z
								d&d�Zef							d'd�Zef							d(d�Z						d)d�Zef							d*d�Z								d+d�Zef											d,d�Zef											d,d�Zef											d,d�Zd
ed
df															d-d�Zd.d�Zef							d*d�Zd �Zy
)/r|z4internal implementation for instrumented attributes.r�
collection�default_accepts_scalar_loaderr�r-�dynamicFrn�_replace_token�
_remove_token�
_append_tokenNc�r�||_||_||_||_||_|xs||_|
|_|�tj|_	n||_	|�||_
n|j|_
|jdd�}
|
|_
|rd|j_|	|_t!|t"�|_y)a�Construct an AttributeImpl.

        :param \class_: associated class

        :param key: string name of the attribute

        :param \callable_:
          optional function which generates a callable based on a parent
          instance, which produces the "default" values for a scalar or
          collection attribute when it's first accessed, if not present
          already.

        :param trackparent:
          if True, attempt to track if an instance has a parent attached
          to it via this attribute.

        :param compare_function:
          a function that compares two values which are normally
          assignable to this attribute.

        :param active_history:
          indicates that get_history() should always return the "old" value,
          even if it means executing a lazy callable upon attribute change.

        :param parent_token:
          Usually references the MapperProperty, used as a key for
          the hasparent() function to identify an "owning" attribute.
          Allows multiple AttributeImpls to all match a single
          owner attribute.

        :param load_on_unexpire:
          if False, don't include this attribute in a load-on-expired
          operation, i.e. the "expired_attribute_loader" process.
          The attribute can still be in the "expired" list and be
          considered to be "expired".   Previously, this flag was called
          "expire_missing" and is only used by a deferred column
          attribute.

        :param send_modified_events:
          if False, the InstanceState._modified_event method will have no
          effect; this means the attribute will never show up as changed in a
          history entry.

        N�_deferred_historyFT)rkrl�	callable_rw�trackparentrp�send_modified_events�operator�eq�is_equal�accepts_scalar_loaderry�poprr��load_on_unexpirern�OP_MODIFIED�_modified_token)r�rkrlr�rwr��compare_function�active_historyrpr�r�r�r�rs              r�r�zAttributeImpl.__init__As���v������"��� ��
�&���(�0�D���$8��!��#�$�K�K�D�M�,�D�M� �,�)>�D�&�)-�)K�)K�D�&�"�J�J�':�E�B��!2����,0�D�M�M�)� 0���2�4��E��r�)rkrlr�rwr�rpr�r�r�r�r�rc�L�|jj�d|j��Sr�r�r�s r�r�zAttributeImpl.__str__�r�r�c�.�|jjS)z(Backwards compat for impl.active_history�rwr�r�s r��_get_active_historyz!AttributeImpl._get_active_history�s���}�}�,�,�,r�c�&�||j_yr�r�r�s  r��_set_active_historyz!AttributeImpl._set_active_history�s��(-��
�
�%r�c��d}|jsJ|��|jjt|j�|�duS)a4Return the boolean value of a `hasparent` flag attached to
        the given state.

        The `optimistic` flag determines what the default return value
        should be if no `hasparent` flag can be located.

        As this function is used to determine if an instance is an
        *orphan*, instances that were loaded from storage should be
        assumed to not be orphans, until a True/False value for this
        flag is set.

        An instance attribute that is loaded by a callable function
        will also not have a `hasparent` flag.

        �6This AttributeImpl is not configured to track parents.F)r��parentsr0�idrp)r�r�r��msgs    r�r�zAttributeImpl.hasparent�sI��$G�����$��$��
�M�M���b��!2�!2�3�Z�@��M�	
r�c	��d}|jsJ|��t|j�}|r||j|<y||jvrx|j|}|dure|j|jk7rL|j��;t
jdt|��dt|��d|j�d���yd|j|<y)z�Set a boolean flag on the given item corresponding to
        whether or not it is attached to a parent object via the
        attribute represented by this ``InstrumentedAttribute``.

        r�FNzRemoving state z from parent state z along attribute 'zV', but the parent record has gone stale, can't be sure this is the most recent parent.)	r�r�rpr�rl�objr.�StaleDataErrorr;)r�r��parent_stater�r��id_�last_parents       r��sethasparentzAttributeImpl.sethasparent�s���G�����$��$����"�"�#���!-�E�M�M�#���e�m�m�#�#�m�m�C�0�� �u�,�#���<�+;�+;�;�"���(�0�%�4�4�!*�%� 0� )�,� 7� $���	����!&�E�M�M�#�r�c��t��r���NotImplementedError�r�r�r1r�s    r�r�zAttributeImpl.get_history�s
��"�#�#r�c��t��)a�Return a list of tuples of (state, obj)
        for all objects in this attribute's current state
        + history.

        Only applies to object-based attributes.

        This is an inlining of existing functionality
        which roughly corresponds to:

            get_state_history(
                        state,
                        key,
                        passive=PASSIVE_NO_INITIALIZE).sum()

        r�r�s    r��get_all_pendingzAttributeImpl.get_all_pending�s
��*"�#�#r�c��|j|vsJd��d}|jjD]}||||�}|tus�|}�|S)z=Produce an empty value for an uninitialized scalar attribute.�O_default_value should only be invoked for an uninitialized or expired attributeN)rlrw�init_scalarr)r�r�r1r��fn�rets      r��_default_valuezAttributeImpl._default_values_��
�x�x�u�$�	
�
1�	
�$�
���-�-�+�+�B��U�E�5�)�C��*�$���,�
�r�c���|j|vr||jS|j}||jvs|j|tur]|tzstS|j|||�}|tus|tur|S|tur	||S|tur|j|||�S|tzstS|j||�S#t$r}td|z�|�d}~wwxYw)z�Retrieve a value from the given object.
        If a callable is assembled on this object's attribute, and
        passive is False, the callable will be executed and the
        resulting value will be set as the new value for this attribute.
        z=Deferred loader for attribute %r failed to populate correctlyN)rl�committed_stater,rr3�_fire_loader_callablesr�KeyErrorr�set_committed_valuerr�)r�r�r1r�rlr�r�s       r�r0zAttributeImpl.get's���8�8�u������?�"��(�(�C��5�0�0�0��(�(��-��9���-�,�,��3�3�E�3��H���-�-��(�1B� �L��l�*�#�$�S�z�)��*�,��3�3�E�5�%�H�H��W�$����*�*�5�%�8�8��$�#�&�(�*-�.�� #�	#��#�s�
C�	C(�C#�#C(c��|jr,|jr ||jvr|j||�S||jvr|j|}|||�S|j
r|j||�StSr�)r�r��expired_attributes�
_load_expired�	callablesr�r)r�r�rlr�r�s     r�r�z$AttributeImpl._fire_loader_callablesTs|��
�&�&��%�%��u�/�/�/��&�&�u�g�6�6�
�E�O�O�
#�����,�I��U�G�,�,�
�^�^��>�>�%��1�1��r�c�0�|j|||||��y�N�r��r"�r�r�r1r��	initiatorr�s      r��appendzAttributeImpl.appendes��	
�����u�i���Ar�c�2�|j||d|||��y)N)r��	check_oldr�r�s      r��removezAttributeImpl.removeos"��	
����5�$�	�7�e�	�	
r�c	�4�|j||d|||d��y)NT)r�r�r�r�r�s      r�r�zAttributeImpl.pop{s*��	
����������	�	
r�c��t��r�r�)r�r�r1r�r�r�r�r�s        r�r"zAttributeImpl.set�s
��"�#�#r�c��t��r�r�)r�r�r1s   r�r%zAttributeImpl.delete�s��!�#�#r�c��|j|jvr$|j|j}|tury|S|j|||��S)z,return the unchanged value of this attributeNr�)rlr�r,r0)r�r�r1r�r�s     r��get_committed_valuez!AttributeImpl.get_committed_value�sO���8�8�u�,�,�,��)�)�$�(�(�3�E��� �����8�8�E�5�'�8�:�:r�c�^�|||j<|j||jg�|S)z=set an attribute value on the given instance and 'commit' it.)rl�_commit)r�r�r1r�s    r�r�z!AttributeImpl.set_committed_value�s*�� ��d�h�h��
�
�
�e�d�h�h�Z�(��r�)FNFNTTN)rkrrlryr��Optional[_LoaderCallable]rw�"_Dispatch[QueryableAttribute[Any]]r�rr�zOptional[Callable[..., bool]]r�rrp�Optional[AttributeEventToken]r�rr�rr�zOptional[bool]r�rr	rr)r�rhr�rhr�rrr2�r�rhr1rOr�r7rr�r�rhr1rOr�r7r�_AllPendingType)r�rhr1rOrr)r�rhr1rOr�r7rr)r�rhrlryr�r7rr�r�rhr1rOr�rr�r�r�r7rr2�r�rhr1rOr�rr�r�r�r7r�rr�rrr2�r�rhr1rOrr2)r�r
rrr�_is_has_collection_adapterr�r
r�r�r�ror�r�r�r4r�r2r�r�r0r�r�r�r�r"r%r�r�r�r�r�r|r|2s���>���#'�'�����
�M�!&��'�'�&�&�&�&�"�:>�$�6:�!%�%)�04�SF�'�SF��SF�-�	SF�
5�SF��
SF�8�SF��SF�4�SF��SF�#�SF� .�SF��SF�j
�I�4�-�
.��1�3F�G�N�=B�
�'�
�59�
�	
�
�2)'�!�)'�)�)'��	)'�

�)'�^ +�	$�!�$��$��	$�

�$� 5�	$�!�$��$��	$�

�$�.�'��0=��	��, +�	+9�!�+9��+9��	+9�


�+9�Z�'��.1��<G��	��. +�
B�!�B��B��	B�
1�B��
B�
�B�  +�

�!�

��

��	

�
1�

��

�
�

�$ +�

�!�
��
��	
�
1�
��

�
�
�.48�*���
$�!�
$��
$��	
$�
1�
$��
$��
$��
$�
�
$�$� +�	;�!�;��;��	;�


�;�"r�r|c����eZdZdZdZdZdZdZdZdZ	�fd�Z
dd�Zef							d
d�Z
deddf															dd	�Z												dd
�Z										dd�Z�xZS)�ScalarAttributeImplz8represents a scalar value-holding InstrumentedAttribute.TF)r{r}r|c���t�|�|i|��t|t�x|_|_t|t�|_yr�)rr�rn�
OP_REPLACEr{r}�	OP_REMOVEr|)r��argr�r�s   �r�r�zScalarAttributeImpl.__init__�sB���
���#�$��$�3F��*�4
�	
���d�0�1��y�A��r�c��|jjr|j||t�}n |j|jt
�}|jjr|j||||j�|j|||�|j|jt
�}|t
ur=|t
ur4|js'|j|jvrtd|z��yyyy)N�%s object does not have a value)rwr�r0r6rlr,r��fire_remove_eventr|�_modified_eventr��expiredr�r��r�r�r1�old�existings     r�r%zScalarAttributeImpl.delete�s����=�=�(�(��(�(�5�%�)@�A�C��)�)�D�H�H�h�/�C��=�=����"�"�5�%��d�6H�6H�I�
���e�T�3�/��9�9�T�X�X�x�0���� ��x���M�M����� 8� 8�8� �!B�T�!I�J�J�9�"� �
!r�c�b�|j|vr$tj||||j�S|j|jvrtj||t�S|t
zr	|t
z}|j
|||��}|turtStj|||�Sr�)	rlr�from_scalar_attributer�r,rr0r3�
HISTORY_BLANK)r�r�r1r��currents     r�r�zScalarAttributeImpl.get_history�s����8�8�u���0�0��u�e�D�H�H�o�N�N�
�X�X��.�.�
.��0�0��u�h�G�G��� ��7�"���h�h�u�e�W�h�=�G��+�+�$�$��4�4�T�5�'�J�Jr�Nc�:�|jjr|j||t�}n |j|jt
�}|jjr|j|||||�}|j|||�|||j<yr�)	rwr�r0r6rlr,r"�fire_replace_eventr��	r�r�r1r�r�r�r�r�r�s	         r�r"zScalarAttributeImpl.set�s����=�=�(�(��(�(�5�%�)@�A�C��)�)�D�H�H�h�/�C��=�=����+�+��u�e�S�)��E�	���e�T�3�/���d�h�h�r�c�n�|jjD]}|||||xs|j�}�|Sr�)rwr"r{�r�r�r1r��previousr�r�s       r�r�z&ScalarAttributeImpl.fire_replace_events=���-�-�#�#�B���u�h�	�(H�T�5H�5H��E�$��r�c�j�|jjD]}||||xs|j��yr�)rwr�r|�r�r�r1r�r�r�s      r�r�z%ScalarAttributeImpl.fire_remove_events/���-�-�&�&�B��u�e�Y�<�$�*<�*<�=�'r�r�)r�rhr1�Dict[str, Any]r�r7rr)r�rhr1r�r�rr�r�r�r7r�r5r�rrr2�r�rhr1rOr�rdr�rr�r�rrd�
r�rhr1rOr�rr�r�rr2)r�r
rrryr�r-rxrzr
r�r%r4r�r"r�r�r:r;s@r�r�r��s<���B�$(�!��L����J��G�B�I�B�K�. +�	K�!�K��K��	K�

�K�048�*�&*�� �!� �� ��	 �
1� ��
 �$� �� �
� �,�!�����	�
��1�
�
��>�!�>��>��	>�
1�>�
�
>r�r�c���eZdZdZdZdZdZdZdZdd�Z	e
f							d
d�Zef							dd�Z
de
ddf															dd	�Z										dd
�Z												dd�Zy)�ScalarObjectAttributeImplz�represents a scalar-holding InstrumentedAttribute,
    where the target object is also instrumented.

    Adds events to delete/set operations.

    FTr�c��|jjr'|j||ttzt
z��}n-|j||ttzt
ztz��}|j||||j�|j|jt�}|tur$|tur|j�td|z��yyy)Nr�r�)rwr�r0r5r(r#r0rr+r�r|r�rlr,r3r�r�s     r�r%z ScalarObjectAttributeImpl.delete+s����=�=�(�(��(�(���/���(�)���C��(�(���(�7�2�(�)�����C�	
���u�e�S�$�2D�2D�E��9�9�T�X�X�x�0��
�� ��,�,��	�	�!� �!B�T�!I�J�J�"�-�
!r�c��|j|vr||j}n4|tzr	|tz}|j|||��}|turtS|j
stj|||�S|jj|jt�}|turB|ttztztztzz}|j||j|�}tj||||��S)Nr�)�original)rlrr0r3r�rr�from_object_attributer��_NO_HISTORYr5r(r#r+rr�)r�r�r1r�r�r��loader_passives       r�r�z%ScalarObjectAttributeImpl.get_historyKs���8�8�u���D�H�H�o�G��� ��7�"���h�h�u�e�W�h�=�G��+�+�$�$��%�%��0�0��u�g�F�F��,�,�0�0����;�G�H��,�,�!(�+�"�#�,�-���,�	,�"�� �6�6��4�8�8�^����0�0��e�W�x�1��
r�c��|j|vr||j}n |tzr|j|||��}ngS|�|tur|turt|�|fg}ndg}|j|jvrK|j|j}|�0|tur(|tur ||ur|jt|�|f�|S)Nr�)NN)rlrr0r3r,r!r�r�)r�r�r1r�r�r�r�s       r�r�z)ScalarObjectAttributeImpl.get_all_pendingms����8�8�u���D�H�H�o�G�
�|�
#��h�h�u�e�W�h�=�G��I�
���0�0��x�'�"�7�+�W�5�6�C��.�C��8�8�u�,�,�,��,�,�T�X�X�6�H��$��$5�5��H�,��G�+��
�
�N�8�4�h�?�@��
r�Nc	��|jjr'|j||ttzt
z��}n-|j||ttzt
ztz��}|�@|tur8||ur4|rytdt|��dt|��d|j�d���|j|||||�}|||j<y)z'Set a value on the given InstanceState.r�NzObject z not associated with z on attribute '�')rwr�r0r5r(r#r0rr+r3�
ValueErrorr"r;rlr�r�s	         r�r"zScalarObjectAttributeImpl.set�s����=�=�(�(��(�(���/���(�)���C��(�(���(�7�2�(�)�����C�
�!��,�,���$��� �#�I�.�	�%�0@�$�(�(�L���
�'�'��u�e�S�)�L����d�h�h�r�c��|jr+|dttfvr|jt	|�|d�|j
jD]}||||xs|j��|j|||�y)NF)	r�r3r,r�r!rwr�r|r�r�s      r�r�z+ScalarObjectAttributeImpl.fire_remove_event�sz���������.
�!
�

���n�U�3�U�E�B��-�-�&�&�B��u�e�Y�<�$�*<�*<�=�'�	���e�T�5�1r�c�^�|jr/||ur+|dttfvr|jt	|�|d�|j
jD]}|||||xs|j�}�|j|||�|jr|�|jt	|�|d�|S)NFT)	r�r3r,r�r!rwr"r{r�r�s       r�r�z,ScalarObjectAttributeImpl.fire_replace_event�s�������u�$���!��:�*�
�!�!�.��":�E�5�I��-�-�#�#�B���u�h�	�(H�T�5H�5H��E�$�
	���e�T�8�4����� ��!�!�.��"7���E��r�r�r�r�r�r�r�)r�r
rrryr�r-rxr
r%r4r�r2r�r"r�r�r�r�r�r�r�sc���%*�!��L����J��I�K�H +�	 �!� �� ��	 �

� �L 5�	"�!�"��"��	"�

�"�R48�*���+ �!�+ ��+ ��	+ �
1�+ ��
+ ��+ ��+ �
�+ �Z2�!�2��2��	2�
1�2�
�
2�&�!�����	�
��1�
�
�r�r�c�8�eZdZUdZded<dZ										d
d�Ze		d									dd��Ze		d									dd��Ze		d									dd��Zd	e	jf									dd
�Zd	e	jd	ddf																	dd�Zy	)�HasCollectionAdapterr�rrxTc��t��r�r��r�r�rx�adapter�
fire_events     r��_dispose_previous_collectionz1HasCollectionAdapter._dispose_previous_collection�s
��"�#�#r�c��yr�r��r�r�r1�	user_datar�s     r��get_collectionz#HasCollectionAdapter.get_collection���� r�c��yr�r�rs     r�rz#HasCollectionAdapter.get_collectionrr�c��yr�r�rs     r�rz#HasCollectionAdapter.get_collection���r�Nc��t��r�r�rs     r�rz#HasCollectionAdapter.get_collections
��"�#�#r�Fc	��t��r�r�)	r�r�r1r�r�r�r�r��_adapts	         r�r"zHasCollectionAdapter.set&s
��"�#�#r��
r�rhrxrSr�rTr�rrr2�..�
r�rhr1rOrz
Literal[None]r�z Literal[PassiveFlag.PASSIVE_OFF]rrT�
r�rhr1rOrrSr�r7rrT�
r�rhr1rOrz$Optional[_AdaptedCollectionProtocol]r�r7rzIUnion[Literal[LoaderCallableStatus.PASSIVE_NO_RESULT], CollectionAdapter]�r�rhr1rOr�rr�r�r�r7r�rr�rrrrr2)r�r
rr
rr�rr
rr7r4r"r�r�r�r�r��s����I���!%��$�!�$�/�$�#�	$�
�$�
�
$��
$'�47� �!� �� �!�	 �
2� �
�
 �� ��
14�"� �!� �� �.�	 �
� �
�
 �� ��
;>�"��!����8�	�
��
�
���;?�*�6�6�	$�!�	$��	$�8�		$�
�	$�
�
	$� 48�*�6�6����$�!�$��$��	$�
1�$��
$��$��$��$�
�$r�r�c��yr�r�)rms r��_is_collection_attribute_implr6s��-0r�rxc����eZdZUdZdZdZdZdZdZde	d<dZ
				d�fd�	Zd	�Ze
f							d d
�Zef							d!d�Z												d"d�Z												d"d
�Z										d#d�Z												d$d�Zd%d�Z						d&d�Z				d'd�Ze
f											d(d�Ze
f											d(d�Ze
f											d(d�Zdejdddf																	d)d�Z										d*d�Z				d+d�Z								d,d�Ze 		d-									d.d��Z!e 		d-									d/d��Z!e de
f									d0d��Z!de
f									d0d�Z!�xZ"S)1�CollectionAttributeImpla�A collection-holding attribute that instruments changes in membership.

    Only handles collections of instrumented objects.

    InstrumentedCollectionAttribute holds an arbitrary, user-specified
    container object (defaulting to a list) and brokers access to the
    CollectionAdapter, a "view" onto that object that presents consistent bag
    semantics to the orm layer independent of the user data implementation.

    TFrn�_bulk_replace_token)�copy�collection_factoryr}r|r�_duck_typed_asNc	����t�|�||||f||d�|	��|�|j}||_||_t|t�|_t|t�|_	t|t�|_tj|j	��|_t|jdd�r9t!j"|d�d��}
t!j"|d�d��}yy)N)r�r��
_sa_linker�init_collectionc�&�|j|�yr��r��targetrx�collection_adapters   r��linkz.CollectionAttributeImpl.__init__.<locals>.link~s���%�%�&8�9r��dispose_collectionc�&�|jd�yr�rrs   r��unlinkz0CollectionAttributeImpl.__init__.<locals>.unlink�s���%�%�d�+r�)rr��_CollectionAttributeImpl__copyrrrn�	OP_APPENDr}r�r|�OP_BULK_REPLACErr?�duck_type_collectionrr�r=�listens_for)
r�rkrlr�rw�typecallabler��
copy_functionr�r�r"r%r�s
            �r�r�z CollectionAttributeImpl.__init__[s����	�������		
�
$�-�
	
��	
�� � �K�K�M�!��	�".���0��y�A���0��y�A���#6�t�_�#M�� �"�7�7��#�#�%�
����4�*�*�L�$�?�
�
�
�t�%6�
7�
:�8�
:��
�
�t�%9�
:�
,�;�
,�@r�c�R�tj|�D�cgc]}|��c}Scc}wr�)rr!)r��item�ys   r��__copyzCollectionAttributeImpl.__copy�s'��&�9�9�$�?�@�?�a��?�@�@��@s�	$c��|j|||��}|tur_|tjzrF|j|j
vr.|j
|j}|j
t�StS|tjzr|j|j
vsJ�tj|||�Sr�)
r0r3r7rrl�_pending_mutations�merge_with_historyr�r�from_collection)r�r�r1r�r��pendings      r�r�z#CollectionAttributeImpl.get_history�s����(�(�5�%��(�9���'�'��+�?�?�?��H�H�� 8� 8�8��2�2�4�8�8�<���1�1�-�@�@�$�$���>�>�>��x�x�u�'?�'?�?�?�?��*�*�4���@�@r�c��|j|vrgS||j}t|d�}|j|jvr�|j|j}|tur�|D�cgc]}|duxrt	|�xsd|f��}}|D�cgc]}|duxrt	|�xsd|f��}}t|�}	t|�}
|D��cgc]
\}}||
vr||f��c}}|D��cgc]\}}||
vs�||f��c}}z|D��cgc]
\}}||	vr||f��c}}zS|D�cgc]}t	|�|f��c}Scc}wcc}wcc}}wcc}}wcc}}wcc}w)N�_sa_adapter)rlr�r�r,r!�dict)
r�r�r1r�r�r��c�current_states�original_states�current_set�original_set�s�os
             r�r�z'CollectionAttributeImpl.get_all_pending�s����8�8�5� ��I�����/���'�=�1���8�8�u�,�,�,��,�,�T�X�X�6�H��x�'�%�"�$���t�m�:���):�B�d�A�F�$��"�&�#�%���t�m�:���):�B�d�A�F�%� �#�
#�>�2��#�O�4��
%3��$2�D�A�q��L�0��A��$2��
+9�N�.�$�!�Q�A��<M��1�v�.�N�O�%4��$3�D�A�q��K�/��A��$3��
��18�8��1���"�A�&��8�8��5"��#����
O����9s*�)D2�
D7�D<�"E�/E�?E�Ec���|jjD]}||||xs|j|��}�|j||td�|j
r|�|j
t|�|d�|S)N�rlT)rwr�r}r�r,r�r�r!�r�r�r1r�r�rlr�s       r��fire_append_eventz)CollectionAttributeImpl.fire_append_event�ss���-�-�&�&�B��u�e�Y�%D�$�2D�2D�#�N�E�'�	���e�T�8�T�:����� 1����n�U�3�U�D�A��r�c�p�|jjD]}||||xs|j|��}�|S)NrA)rw�append_wo_mutationr}rBs       r��fire_append_wo_mutation_eventz5CollectionAttributeImpl.fire_append_wo_mutation_event�s:���-�-�2�2�B��u�e�Y�%D�$�2D�2D�#�N�E�3��r�c�4�|j||td�y)afA special event used for pop() operations.

        The "remove" event needs to have the item to be removed passed to
        it, which in the case of pop from a set, we don't have a way to access
        the item before the operation.   the event is used for all pop()
        operations (even though set.pop is the one where it is really needed).

        TN)r�r,)r�r�r1r�rls     r��fire_pre_remove_eventz-CollectionAttributeImpl.fire_pre_remove_event�s��	���e�T�8�T�:r�c���|jr|�|jt|�|d�|jjD]}||||xs|j
|���|j
||td�y)NFrAT)r�r�r!rwr�r|r�r,rBs       r�r�z)CollectionAttributeImpl.fire_remove_event�sl������ 1����n�U�3�U�E�B��-�-�&�&�B��u�e�Y�<�$�*<�*<�#�F�'�	���e�T�8�T�:r�c���|j|vry|j||td�|j||j�}|j�||j=yr�)rlr�r,rr8�clear_with_event)r�r�r1rxs    r�r%zCollectionAttributeImpl.deletesT���8�8�5� ��
���e�T�8�T�:��(�(���
�
�;�
��#�#�%�
�$�(�(�Or�c���|j|vsJd��|j|jvr|j|jS|j|�\}}|j|�|S)z;Produce an empty collection for an un-initialized attributer�)rl�_empty_collections�_initialize_collection�
_set_empty)r�r�r1r�rs     r�r�z&CollectionAttributeImpl._default_valuest��
�x�x�u�$�	
�
1�	
�$�
�8�8�u�/�/�/��+�+�D�H�H�5�5�!�8�8��?�������9�%��r�c��|jj|j||j�\}}|jj|||�||fSr�)r��initialize_collectionrlrrwr)r�r�r�rxs    r�rNz.CollectionAttributeImpl._initialize_collection-sQ��$�m�m�A�A��H�H�e�T�4�4�
����	
�
�
�%�%�e�Z��A��
�"�"r�c�F�|j||d|��}|turZ|j||||t��}|j|vsJd��|j|j�j
|�ytrt|t�sJ�|j||�y�N)rr�rAz,Collection was loaded during event handling.)rr3rCr*rl�_get_pending_mutationr�rr�rT�append_with_event�r�r�r1r�r�r�rxs       r�r�zCollectionAttributeImpl.append8s����(�(��5�D�'�)�
�
��*�*��*�*��u�e�Y�F�+��E�����%�
>�=�
>�%��'�'����1�8�8��?��!�*�.?�@�@�@��(�(��	�:r�c�Z�|j||jd|��}|turZ|j||||t��|j
|vsJd��|j
|j
�j|�ytrt|t�sJ�|j||�yrS)rr8r3r�r*rlrTr�rr�rT�remove_with_eventrVs       r�r�zCollectionAttributeImpl.removePs����(�(��5�:�:��w�)�
�
��*�*��"�"�5�%��	�v�"�N�����%�
>�=�
>�%��'�'����1�8�8��?��!�*�.?�@�@�@��(�(��	�:r�c�f�	|j|||||��y#tttf$rYywxYwr�)r�r�r��
IndexErrorr�s      r�r�zCollectionAttributeImpl.popfs8��	�
�K�K��u�e�Y��K�H���H�j�1�	��	�s��0�0c	���|x}	}
d}|j|�\}}
|r�|j�|j|	�}	n�tj|	�}|j}||urH|	duxrdxs|	j
j}|jj}td|�d|�d���t|	d�r|	j�}	nV|turt|	�}|	j�}	n2t|	�}	n&tj|	�turt|�}t|	�}|j}|jj!||||��|j#||t$|t&j(zz��}|t*ur|j-||�}n||
ury|j/|||d�|j0}|
||j2<t5j ||||�	�|j7|||d�y)
Nr2zIncompatible collection type: z is not z-like�_sa_iterator)�keysr�T)r�)rN�
_converterr?r)rr�r��	TypeErrorrUr\r8�list�values�iterrrw�bulk_replacer0r5r7r+r3r�r�r7rlrr)r�r�r1r�r�r�r�r�r�iterable�
orig_iterable�new_keys�new_collectionr�setting_type�receiving_type�given�wanted�
new_values�evtr��old_collections                      r�r"zCollectionAttributeImpl.setvs���$)�(��=���%)�$?�$?��$F�!��	���(�(�4�)�4�4�X�>��#�8�8��B��!%�!4�!4���~�5� �D�(�#�"�7�#�-�-�6�6��
"�0�0�9�9�F�#� �&�*����8�^�4�'�4�4�6�H�!�T�)�#�H�~�H�'���0�H�#�H�~�H�
�
&�
&�x�
0�D�
8��E�{�H��(�^�
��&�&���
�
�"�"�5�*�c��"�I��h�h���+�w��9M�9M�/M�N��
��
�#�#��%�%�e�U�3�C�
�M�
!�
�	���e�T�3��5�����#��d�h�h��� � ����#�	
�	
�)�)�%��n�d�Kr�c��|`|jj|jd�|r|jj|||�yyr�)r7rMr�rlrwr#r�s     r�rz4CollectionAttributeImpl._dispose_previous_collection�sD��
�"�	� � �$�$�T�X�X�t�4���M�M�,�,�U�J��H�r�c�*�t|d�}d|_y)Nr7T)r��invalidated)r�rxr�s   r��_invalidate_collectionz.CollectionAttributeImpl._invalidate_collection�s���*�m�4��"��r�c���|j|�\}}|r|j|�||j|j<|j	||jg�|j|j
vr�|j
|||d�|j
j|j�}|j}|j}|D]}	|j|	��|D]}	|j|	��|S)z=Set an attribute value on the given instance and 'commit' it.T)rN�append_multiple_without_eventr8rlr�r2r�r��added_items�
deleted_items�append_without_event�remove_without_event)
r�r�r1r�rxrr5�added�removedr.s
          r�r�z+CollectionAttributeImpl.set_committed_value�s���
!%� ;� ;�E� B��
�I���4�4�U�;�(��
�
�4�8�8��
�
�
�e�d�h�h�Z�(��8�8�u�/�/�/�
�!�!�%��y�$�?��.�.�2�2�4�8�8�<�G��'�'�E��+�+�G����/�/��5�����/�/��5� ��r�.c��yr�r�rs     r�rz&CollectionAttributeImpl.get_collection�rr�c��yr�r�rs     r�rz&CollectionAttributeImpl.get_collectionrr�c��yr�r�rs     r�rz&CollectionAttributeImpl.get_collectionrr�c��|�4|j|||��}|tjur|Std|�}|jS)z�Retrieve the CollectionAdapter associated with the given state.

        if user_data is None, retrieves it from the state using normal
        "get()" rules, which will fire lazy callables or return the "empty"
        collection value.

        r�rS)r0r$r3rr7)r�r�r1rr��fetch_user_datas      r�rz&CollectionAttributeImpl.get_collectionsL�� ��"�h�h�u�e�W�h�E�O��"6�"H�"H�H�&�&� �!=��O�	��$�$�$r�)NFNNr�r�)r�rhr1rOr�rdr�r�rl�
Optional[Any]rrd)
r�rhr1rOr�r�rlr�rr2)r�rhr1rOr�rr�r�rlr�rr2r�)r�rhr1rOrrS)r�rhrz4Tuple[CollectionAdapter, _AdaptedCollectionProtocol]r�rr)rxrSrr2)r�rhr1rOr�rrrSr
rrr)#r�r
rrr�rxryr-rzrr
r�r&r4r�r2r�rCrFrHr�r%r�rNr�r�r�r7r"rrrr�r
rr:r;s@r�rr>s����	��L��J�$)�!����G�,�,��I�����),�VA� +�	A�!�A��A��	A�

�A�: 5�	+9�!�+9��+9��	+9�

�+9�Z�!�����	�
1���
�
��$�!�����	�
1���
�
��;�!�;��;�1�	;�
�;�
�
;�";�!�;��;��	;�
1�;��
;�
�;� ��'��0=��	#��"	#�'�	#�	=�	#�" +�
;�!�;��;��	;�
1�;��
;�
�;�< +�
;�!�;��;��	;�
1�;��
;�
�;�8 +�
�!�����	�
1���
�
��*48�*�6�6����OL�!�OL��OL��	OL�
1�OL��
OL��OL��OL��OL�
�OL�b
I�!�
I�/�
I�#�	
I�
�
I�
�

I�#�4�#�	
�#��'��0=��FI��	#��:�
$'�47� �!� �� �!�	 �
2� �
�
 �� ��
14�"� �!� �� �.�	 �
� �
�
 �� ��
;>�*��!����8�	�
��
�
���;?�*�%�!�%��%�8�	%�
�%�
�
%r�rc�2��������jj��j��fd������fd�}���fd�}���fd�}�rtj�d|ddd��ntj�d|ddd��tj�d	|ddd��y
)z6Apply listeners to synchronize a two-way relationship.c���tdt|��d|j�d|j�d�jj�d�	��)Nz:Bidirectional attribute conflict detected: Passing object z to attribute "z(" triggers a modify event on attribute "z" via the backref "z".)r�r;rprm)�child_stater��
child_implr_s   �r��_acceptable_key_errz.backref_listeners.<locals>._acceptable_key_err@s>�����+�&��&�&��'�'����+�+�	
�
�	
r�c����||ur|S|��|tur�|tur�t|�t|�}}|j�j
}|js|js
|j}n|j}||ur2|j|||j��jt��|��t|�t|�}
}	|	j�j
}|j�ur"|j|jur
�|||�|j}t|�r|j nd}
||ur,||
ur(|j#|	|
|j�|t��|Sr�)r3r,r!r r�rmrxrzr{r|r�r�r}r0rprrr�)r��child�oldchildr�r��	old_state�old_dictrm�check_recursive_tokenr��
child_dictr��check_append_token�check_bulk_replace_tokenr�rl�parent_implrps              ����r��"emit_backref_from_scalar_set_eventz=backref_listeners.<locals>.emit_backref_from_scalar_set_eventNs�����u���L�� �� 1�1���(�
�x�(��h�'� �I��$�$�S�)�.�.�D��?�?�4�<�<�(,�(;�(;�%�(,�(:�(:�%�� 5�5�������I�I�K��-�-�,������u�%��e�$�$�K�%�,�,�S�1�6�6�J��&�&�l�:��*�*�*�2I�2I�I�#�E�9�j�A�",�!9�!9��1��<��.�.��
%��!3�3��%=�=��!�!����I�I�K��,�"���r�c�v��|�yt|�t|�}}|j�
j}|j�ur"|j|jur
�	|||�|j
}t
|�r|jnd}||ur,||ur(|j|||j�|t��|Sr�)r!r r�rmrpr}rrr�r�r0)r�r�r�r�r�r�r�r�r�r�rlrps         ���r��)emit_backref_from_collection_append_eventzDbackref_listeners.<locals>.emit_backref_from_collection_append_event�s�����=��"0��"7��u�9M�Z�� �(�(��-�2�2�
�
�"�"�,�6��&�&�j�.E�.E�E���y�*�=�(�5�5��-�Z�8�
�*�*��	!�
�/�/��!9�9�������	�	���(�
�
��r�c�(��|��|tu�r|tur�t|�t|�}}|j�
j
}|js6|js*|j}|j}�xr
�j}	n'|j}t|�r|jnd}d}	||ur^||urY|	r-tj|j�j|�s)|j!|||j#�|t$��yyyyyyy)NFr�)r3r,r!r r�rmrxrzr|r{rrr?�	has_dupesr8rlr�r�r0)
r�r�r�r�r�r�r��check_remove_token�check_replace_token�check_for_dupes_on_removerlr��uselists
          ���r��)emit_backref_from_collection_remove_eventzDbackref_listeners.<locals>.emit_backref_from_collection_remove_event�s:���
���.�.��X�%��u�%��e�$�$�K�%�,�,�S�1�6�6�J�
�(�(��1C�1C�%/�%=�%=�"�&0�&?�&?�#�,3�,O�K�<O�<O�8O�)�%/�%=�%=�"�5�Z�@��2�2��$�
-2�)��!3�3��%8�8�0�����J�J�{���/��	9��N�N�#�"��	�	��!� 0�#��
9�9�4�3&�/�
r�r�T)r\�raw�include_keyr"r�N)rmrpr=�listen)	r_rlr�r�r�r�r�r�rps	```   @@@r��backref_listenersr�0s�����>�>�.�.�L��.�.�K�
�A�F"�H.�`�
�����5����
	
�	�����.����
	
�
�L�L���1����
r��
NO_HISTORYc���eZdZUdZded<ded<ded<dd�Zdd�Zdd�Zdd	�Zdd
�Z	dd�Z
dd�Zdd
�Ze
								dd��Ze
ef									dd��Ze
								dd��Zy)raA 3-tuple of added, unchanged and deleted values,
    representing the changes which have occurred on an instrumented
    attribute.

    The easiest way to get a :class:`.History` object for a particular
    attribute on an object is to use the :func:`_sa.inspect` function::

        from sqlalchemy import inspect

        hist = inspect(myobject).attrs.myattribute.history

    Each tuple member is an iterable sequence:

    * ``added`` - the collection of items added to the attribute (the first
      tuple element).

    * ``unchanged`` - the collection of items that have not changed on the
      attribute (the second tuple element).

    * ``deleted`` - the collection of items that have been removed from the
      attribute (the third tuple element).

    zUnion[Tuple[()], List[Any]]ry�	unchanged�deletedc��|tk7Sr�)r�r�s r��__bool__zHistory.__bool__#	s
���}�$�$r�c�f�t|jxs|jxs|j�S)zhReturn True if this :class:`.History` has no changes
        and no existing, unchanged state.

        )rryr�r�r�s r��emptyz
History.empty&	s(������3�t�|�|�F����G�G�Gr�c�f�|jxsg|jxsgz|jxsgzS)z3Return a collection of added + unchanged + deleted.)ryr�r�r�s r��sumzHistory.sum.	s1���Z�Z�
�2�$�.�.�"6�B�7�4�<�<�;M�2�N�	
r�c�D�|jxsg|jxsgzS)z)Return a collection of added + unchanged.)ryr�r�s r��non_deletedzHistory.non_deleted5	s!���
�
� �b�T�^�^�%9�r�:�:r�c�D�|jxsg|jxsgzS)z+Return a collection of unchanged + deleted.)r�r�r�s r��	non_addedzHistory.non_added:	s!�����$�"����);��<�<r�c�H�t|jxs|j�S)z2Return True if this :class:`.History` has changes.)rryr�r�s r��has_changeszHistory.has_changes?	s���D�J�J�.�$�,�,�/�/r�c��tt|j�t|�z|jt|j�t|�z�Sr�)rr`ryr�r�)r�ryr�s   r��_mergezHistory._mergeD	s@��������t�E�{�*��N�N�������g��.�
�	
r�c
�<�t|jD�cgc]}|duxrt|�xsd��c}|jD�cgc]}|duxrt|�xsd��c}|jD�cgc]}|duxrt|�xsd��c}�Scc}wcc}wcc}wr�)rryr!r�r�)r�r9s  r��as_statezHistory.as_stateK	s�������
�#�A��$��5�N�1�$5�=��=�#�
����
�'�A��$��5�N�1�$5�=��=�'�
����
�%�A��$��5�N�1�$5�=��=�%�
�

�
	
��
��
��
s�B�B
�,Bc�|�|jj|jt�}|tur|tur
|ddd�S|d|gd�S|tur|j||�dur|d|gd�St
|�tvrd}t
|�tvrd}n|g}|tur
|dd|�S||gd|�S)Nr�T)r�r0rlr�r,r�r��_NO_STATE_SYMBOLS�r r_r�r�r�r�s      r�r�zHistory.from_scalar_attribute[	s����(�(�,�,�Y�]�]�K�H���{�"��(�"��2�r�2��&��2��y�"�-�-�
�8�#��"�"�7�H�5��=��r�G�9�b�)�)��(�|�0�0����g�;�"3�3�"�G�#�*���(�"��2�r�7�+�+��G�9�b�'�2�2r�c�p�|tur*|jj|jt�}|tur|tur
|ddd�S|d|gd�S||ur|tur|d|gd�St|�tvs|�d}t|�tvrd}n|g}|tur
|dd|�S||gd|�S)Nr�)r�r�r0rlr,r�r�r�s      r�r�zHistory.from_object_attribute�	s����{�"��,�,�0�0�����L�H��{�"��(�"��2�r�2��&��2��y�"�-�-�
��
 �W�H�%<��r�G�9�b�)�)��(�|�0�0�H�4D����g�;�"3�3�"�G�#�*���(�"��2�r�7�+�+��G�9�b�'�2�2r�c
��|jj|jt�}|tur
|ddd�St|d�}|tur|t
|�dd�S|tur|dt
|�d�S|D�cgc]}|duxrt|�xsd|f��}}|D�cgc]}|duxrt|�xsd|f��}}t|�}t|�}	||D�
�cgc]\}
}|
|	vs�|��c}}
|D�
�cgc]\}
}|
|	vs�|��c}}
|D�
�cgc]\}
}|
|vs�|��c}}
�Scc}wcc}wcc}}
wcc}}
wcc}}
w)Nr�r7)	r�r0rlr�r,r�r`r!r8)r r_r�r�r�r9r:r;r<r=r>r?s            r�r4zHistory.from_collection�	s|���(�(�,�,�Y�]�]�K�H���h���r�2�r�?�"��'�=�1���x���t�G�}�b�"�-�-�
��
$��r�4��=�"�-�-�!�� �A��4�-�6�^�A�%6�>�$��B� �
��"��!�A��4�-�6�^�A�%6�>�$��B�!�
��
�~�.�K���0�L��-�G�~�t�q�!��,�1F��~�G�-�C�~�t�q�!��l�1B��~�C�.�G��t�q�!�!�;�2F���G��
������H��C��Gs0�D/�'D4�$D9
�1D9
�=D?�
D?�E�#ENr)rz
Sequence[Any])ry�
Iterable[Any]r�r�rr)rr)r_r�r�rhr�rrr)
r_r�r�rhr�rr�rrr)r_rr�rhr�rrr)r�r
rrrr�r�r�r�r�r�r�r��classmethodr�r�r�r4r�r�r�rr	s���0'�&�*�*�
(�(�%�H�
�;�
=�
0�

�
� �&3�&�&3�"�&3��	&3�

�&3��&3�P�$�$3�,�$3�"�$3��	$3�
�$3�
�
$3��$3�L� �*� �"� ��	 �

� �� r�rr�c�.�tt|�||�S)a
Return a :class:`.History` record for the given object
    and attribute key.

    This is the **pre-flush** history for a given attribute, which is
    reset each time the :class:`.Session` flushes changes to the
    current database transaction.

    .. note::

        Prefer to use the :attr:`.AttributeState.history` and
        :meth:`.AttributeState.load_history` accessors to retrieve the
        :class:`.History` for instance attributes.


    :param obj: an object whose class is instrumented by the
      attributes package.

    :param key: string attribute name.

    :param passive: indicates loading behavior for the attribute
       if the value is not already present.   This is a
       bitflag attribute, which defaults to the symbol
       :attr:`.PASSIVE_OFF` indicating all necessary SQL
       should be emitted.

    .. seealso::

        :attr:`.AttributeState.history`

        :meth:`.AttributeState.load_history` - retrieve history
        using loader callables if the value is not locally present.

    )�get_state_historyr!)r�rlr�s   r�r�r��	s��J�^�C�0�#�w�?�?r�c�&�|j||�Sr�)r�)r�rlr�s   r�r�r��	s�����S�'�*�*r�c�T�t|�}t|�}|j|||�S)�TODO)r%r!�
has_parent)r r�rlr�r�r�s      r�r�r�
s-���s�#�G��3��E����e�S�*�5�5r�)rLc�@�t|||||��}t||fi|��|S)N)rnr{rL)�register_descriptor�register_attribute_impl)rkrlrnr{rLr��descs       r��register_attributer�	
s/�����
��3��D��F�C�.�2�.��Kr�c���t|�}|r-|jdd�}	|j||	xst�}
n|jdd�}
t	d||j
�}|rt	d|�|||fi|��}n5|rt
||||fd|
i|��}n!|rt||||fi|��}nt||||fi|��}|||_	|rt||||�|j|�||S)Nr+r�zType[WriteOnlyAttributeImpl])r%r��instrument_collection_classr`rrwrr�r�rmr��post_configure_attribute)
rkrlr�r��	useobject�
impl_class�backrefr�r��factoryr+rwrms
             r�r�r�
s&���v�&�G���&�&���.���:�:����D�
���v�v�n�d�3���,�g�c�l�.C�.C��H��@�t�2�J�?��C��
�%'�
��
�&��C��H�
�;G�
�KM�
��
�(��C��H�
�02�
��#�6�3�	�8�J�r�J���G�C�L����'�#�,���9��$�$�S�)��3�<�r�c�l�t|�}t||||��}||_|j||�|S)N)rnr{)r%rr�instrument_attribute)rkrlrnr{rLr�rHs       r�r�r�L
sA���v�&�G�&���
���J��J��� � ��j�1��r�c�8�t|�j|�yr�)r%�uninstrument_attribute)rkrls  r��unregister_attributer�`
s���V��3�3�C�8r�c�J�t|�}|j}t|||�S)a4Initialize a collection attribute and return the collection adapter.

    This function is used to provide direct access to collection internals
    for a previously unloaded attribute.  e.g.::

        collection_adapter = init_collection(someobject, "elements")
        for elem in values:
            collection_adapter.append_without_event(elem)

    For an easier way to do the above, see
    :func:`~sqlalchemy.orm.attributes.set_committed_value`.

    :param obj: a mapped object

    :param key: string attribute name where the collection is located.

    )r!r8�init_state_collection)r�rlr�r1s    r�rrd
s&��$
�3��E��J�J�E� ���s�3�3r�c�Z�|j|j}trt|t�sJ�|j|d�}|� |j}|j|||d�|j||�}|j|||tj��}|j�|S)z�Initialize a collection attribute and return the collection adapter.

    Discards any existing collection which may be there.

    NFr�)
r�rmrr�r�r�r7rr�rr7r0�_reset_empty)r�r1rl�attrr�rnrr�s        r�r�r�{
s����=�=���"�"�D���$� 4�5�5�5�
�)�)�C��
�C�
�������)�)�%��n�e�L��#�#�E�5�1�I�!%�!4�!4�
�u�i��)E�)E�"5�"�G������Nr�c��t|�t|�}}|j|jj	|||�y)a[Set the value of an attribute with no history events.

    Cancels any previous history present.  The value should be
    a scalar value for scalar-holding attributes, or
    an iterable for any collection-holding attribute.

    This is the same underlying method used when a lazy loader
    fires off and loads additional data from the database.
    In particular, this method can be used by application code
    which has loaded additional attributes or collections through
    separate queries, which can then be attached to an instance
    as though it were part of its original loaded state.

    N)r!r r�rmr�)r�rlr�r�r1s     r�r�r��
s8��"�(�+�]�8�-D�5�E�	�M�M�#����/�/��u�e�Dr�c��t|�t|�}}|j|jj	||||�y)asSet the value of an attribute, firing history events.

    This function may be used regardless of instrumentation
    applied directly to the class, i.e. no descriptors are required.
    Custom attribute management schemes will need to make usage
    of this method to establish attribute state as understood
    by SQLAlchemy.

    :param instance: the object that will be modified

    :param key: string name of the attribute

    :param value: value to assign

    :param initiator: an instance of :class:`.Event` that would have
     been propagated from a previous event listener.  This argument
     is used when the :func:`.set_attribute` function is being used within
     an existing event listening function where an :class:`.Event` object
     is being supplied; the object may be used to track the origin of the
     chain of events.

     .. versionadded:: 1.2.3

    N)r!r r�rmr")r�rlr�r�r�r1s      r��
set_attributer��
s:��<"�(�+�]�8�-D�5�E�	�M�M�#�������u�e�Y�?r�c��t|�t|�}}|j|jj	||�S)aZGet the value of an attribute, firing any callables required.

    This function may be used regardless of instrumentation
    applied directly to the class, i.e. no descriptors are required.
    Custom attribute management schemes will need to make usage
    of this method to make usage of attribute state as understood
    by SQLAlchemy.

    )r!r r�rmr0�r�rlr�r1s    r��
get_attributer��
s9��"�(�+�]�8�-D�5�E��=�=���"�"�&�&�u�e�4�4r�c��t|�t|�}}|j|jj	||�y)aQDelete the value of an attribute, firing history events.

    This function may be used regardless of instrumentation
    applied directly to the class, i.e. no descriptors are required.
    Custom attribute management schemes will need to make usage
    of this method to establish attribute state as understood
    by SQLAlchemy.

    N)r!r r�rmr%r�s    r��
del_attributer��
s6��"�(�+�]�8�-D�5�E�	�M�M�#����"�"�5�%�0r�c���t|�t|�}}|j|j}|jj||j�|j||td��y)a�Mark an attribute on an instance as 'modified'.

    This sets the 'modified' flag on the instance and
    establishes an unconditional change event for the given attribute.
    The attribute must have a value present, else an
    :class:`.InvalidRequestError` is raised.

    To mark an object "dirty" without referring to any specific attribute
    so that it is considered within a flush, use the
    :func:`.attributes.flag_dirty` call.

    .. seealso::

        :func:`.attributes.flag_dirty`

    T��is_userlandN)	r!r r�rmrw�modifiedr�r�r,)r�rlr�r1rms     r��
flag_modifiedr��
s\��""�(�+�]�8�-D�5�E��=�=���"�"�D��M�M���5�$�"6�"6�7�	���%��x�T��Br�c�b�t|�t|�}}|j|dtd��y)a�Mark an instance as 'dirty' without any specific attribute mentioned.

    This is a special operation that will allow the object to travel through
    the flush process for interception by events such as
    :meth:`.SessionEvents.before_flush`.   Note that no SQL will be emitted in
    the flush process for an object that has no changes, even if marked dirty
    via this method.  However, a :meth:`.SessionEvents.before_flush` handler
    will be able to see the object in the :attr:`.Session.dirty` collection and
    may establish changes on it, which will then be included in the SQL
    emitted.

    .. versionadded:: 1.2

    .. seealso::

        :func:`.attributes.flag_modified`

    NTr�)r!r r�r,)r�r�r1s   r��
flag_dirtyr��
s.��("�(�+�]�8�-D�5�E�	���%��x�T��Br�)
rlryr�Type[_O]r{rr�rxrr)rHrrz&Callable[..., QueryableAttribute[Any]])rmr|rz"TypeGuard[CollectionAttributeImpl])r_�QueryableAttribute[Any]rlryr�rrr2)r�r3rlryr�r7rr)r�rhrlryr�r7rrr)
r r�r�rRrlryr�rrr)rkr�rlryrn�interfaces.PropComparator[_T]r{rrLr�r�rr�InstrumentedAttribute[_T])FNFNN)rkr�rlryr�rr�r�r�rr�zOptional[Type[AttributeImpl]]r�r�r�rrr�)rk�	Type[Any]rlryrnr�r{rzrLr�rr�)rkr�rlryrr2)r�r3rlryrrT)r�rhr1rOrlryrrTr�)
r�r3rlryr�rr�r�rr2)r�r3rlryrr)r�r3rlryrr2r4)�r�
__future__r�dataclassesr��typingrrrrrr	r
rrr
rrrrrr�rrr.r�_typingrrBrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r=r>r?r@rA�sql�sql_baserCrDrErF�
sql.cache_keyrG�sql.visitorsrHrI�util.typingrJrKrLrMrNrOrPrQrRrSrTrU�
relationshipsrVr�rWrX�	writeonlyrY�
event.baserZ�sql._typingr[r\r]r^�sql.annotationr_�sql.elementsr`ra�
sql.operatorsrb�sql.selectablercrdrer3r�r��_self_inspects�InspectionAttr�PropComparator�JoinTargetRole�OnClauseRole�	Immutable�SlotsMemoizedHasCacheKeyr�rjr�r�	dataclassr>rg�symbolr�r'r�r(r�rn�AttributeEvent�Eventr|r�r�r�r�
attrgetterrr�r��	frozensetr�r�rr�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r��<module>rs����#���������������� ������*�$����'�+��0�2��(�&�6�"�������#�>�(�"�*�'�#��)�)��#��"��������"�����'�1�,�!��#��$�,�&�,�(��7�.�*�3�$�!�1�&�7�0�'�1�0�,�$�,�+�
�T�]����s�d�3���	�(�'�
(�(�6�*:�
:�;���
�H�����b(��u���U��������e�$�	���	������
�&�&�����b(��b(�J$�	�$��$�*�$�
%�	$�
	�$�</�.�u�5�</�~����d�#�
7�k�
7�$�
7� g��g�+�g�T
�D�K�K��!�	��D�K�K��!�	�
�T�[�[��
#�
��$�+�+�n�-���d�k�k�*�%��0*�0*�f%����@�@�Fd>�-�d>�NP� 3�P�fB$�B$�J�1��1�	+�1�
%8�H�$7�$7��$E�!�o%�2�M�o%�dO�&�O�-0�O�;?�O�	�O�d�d�k�k�,�'���r�"3�4�b��l�C�D��F�j�F�R��B��#�
�3>�%@�	�%@��%@�$/�%@��%@�RAL�+��+�$'�+�2=�+��+�:?�6�	�6��6�!$�6�26�6�	�6��

��
�	�
�.�	
�
*�
�
�

��
��
�&�+/��04�!�0��0�	�0��0�)�	0�
�0�.�
0��0��0��0�r�
���	��.�	�
+��
�
���(9�4�.���&3��:=����6E�.04�	@��@�	�@��@�-�	@�

�@�D5�1�C�.Cr�

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