Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/orm/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/orm/__pycache__/dynamic.cpython-312.pyc
�

���gX&��n�dZddlmZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlmZddlm
Z
d
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZddlmZddl m!Z!er0d
dlm"Z"d
dl#m$Z$d
dlm%Z%d
dlm&Z&d
dl'm(Z(d
d lm)Z)dd!l*m+Z+dd"l,m-Z-ed#e�$�Z.Gd%�d&ee.�Z/Gd'�d(e�Z0ejbjed)�*�Gd+�d,e��Z3Gd-�d.ee.�Z4Gd/�d0e4e.ee.�Z5d3d1�Z6y2)4z�Dynamic collection API.

Dynamic collections act like Query() objects for read operations and support
basic add/delete mutation.

.. legacy:: the "dynamic" loader is a legacy feature, superseded by the
 "write_only" loader.


�)�annotations)�Any)�Iterable)�Iterator)�List)�Optional)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�
attributes)�exc)�
relationships)�util)�PassiveFlag)�Query)�object_session)�AbstractCollectionWriter)�WriteOnlyAttributeImpl)�WriteOnlyHistory)�WriteOnlyLoader�)�result)�QueryableAttribute)�Mapper)�_RelationshipOrderByArg)�Session)�
InstanceState)�AliasedClass)�	_Dispatch)�
ColumnElement�_T)�boundc�*�eZdZ	d									dd�Zy)�DynamicCollectionHistoryNc�j�|r_t||�jd�}tj|�|_|j
|_|j|_d|_ytj�|_tj�|_tj�|_d|_y)NFT)�
AppenderQuery�	autoflushr�OrderedIdentitySet�unchanged_items�added_items�
deleted_items�_reconcile_collection)�self�attr�state�passive�apply_to�colls      �G/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/orm/dynamic.py�__init__z!DynamicCollectionHistory.__init__>s���� ��u�-�7�7��>�D�#'�#:�#:�4�#@�D� �'�3�3�D��!)�!7�!7�D��)-�D�&�!%�!8�!8�!:�D��#�6�6�8�D��#'�#:�#:�#<�D� �).�D�&��N)
r1�DynamicAttributeImplr2�InstanceState[_T]r3rr4z&Optional[DynamicCollectionHistory[_T]]�return�None)�__name__�
__module__�__qualname__r7�r8r6r'r'=s=��<@�/�"�/�!�/��	/�
9�/�
�
/r8r'c�P�eZdZUdZeeZded<	d															dd�Zy)r:TzType[AppenderMixin[Any]]�query_classNc��tjj|||d|fi|��||_|rt	|�|_|st|_yt|j�vr||_yt|�|_yr9)r�
AttributeImplr7�
target_mapper�tuple�order_byr)rC�
AppenderMixin�mro�mixin_user_query)r0�class_�key�dispatchrFrHrC�kws        r6r7zDynamicAttributeImpl.__init__Wsr��	� � �)�)��&�#�t�X�	
�13�	
�+����!�(�O�D�M��,�D��
�k�o�o�/�
/�*�D��/��<�D�r8r9)rLz#Union[Type[Any], AliasedClass[Any]]rM�strrNz"_Dispatch[QueryableAttribute[Any]]rFz
Mapper[_T]rHrrCz!Optional[Type[AppenderMixin[_T]]]rOrr<r=)	r>r?r@�_supports_dynamic_iterationr'r�collection_history_cls�__annotations__r7rAr8r6r:r:Rsq��"&��5�c�:��)�)�:>�=�3�=��=�5�	=�
"�=�*�
=�7�=��=�
�=r8r:�dynamic)�lazyc��eZdZeZy)�
DynaLoaderN)r>r?r@r:�
impl_classrAr8r6rWrWos��%�Jr8rWc����eZdZUdZdZded<ded<						d�fd�Zedd��Zejdd	��Zdd
�Z
erdd�Zdd�Z
dd
�Z	d			dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z�xZS)rIzTA mixin that expects to be mixing in a Query class with
    AbstractAppender.


    NzOptional[Type[Query[_T]]]rCzTuple[ColumnElement[Any], ...]�_order_by_clausesc�h��tj||jd�t�|�||�yr9)rr7rF�super)r0r1r2�	__class__s   �r6r7zAppenderMixin.__init__~s1���	��������	
�
	����u�%r8c���t|j�}|�*|jr|j|vr|j�t	j
|j�sy|Sr9)r�instancer*�flush�orm_util�has_identity�r0�sesss  r6�sessionzAppenderMixin.session�sJ���d�m�m�,�������4�=�=�D�3H��J�J�L��$�$�T�]�]�3���Kr8c��||_yr9)rd)r0res  r6rezAppenderMixin.session�s	����	r8c
�j�|j}|��tj|j�}|jr+tjdtj|�z�tjtj|jjjg�t|jj!tj|j�t"j$�j&�d��j)�S|j+|�j-�S)Nz�Instance %s is detached, dynamic relationship cannot return a correct result.   This warning will become a DetachedInstanceError in a future release.T)�_source_supports_scalars)rer�instance_stater_�detachedr�warnra�	state_strr�IteratorResult�SimpleResultMetaDatar1rLr>�iter�_get_collection_historyr�PASSIVE_NO_INITIALIZEr-�scalars�	_generate�_iter)r0rdr2s   r6rtzAppenderMixin._iter�s����|�|���<��-�-�d�m�m�<�E��~�~��	�	�C� �)�)�%�0�2���(�(��+�+�T�Y�Y�-=�-=�-F�-F�,G�H���I�I�5�5�"�1�1�$�-�-�@�#�9�9��"�k�	�*.�	��g�i�	
��>�>�$�'�-�-�/�/r8c��yr9rA)r0s r6�__iter__zAppenderMixin.__iter__�s��Cr8c�
�|j}|�V|jjtj|j
�tj�j|�S|j|�j|�Sr9)rer1rprrir_rrq�indexedrs�__getitem__)r0�indexrds   r6ryzAppenderMixin.__getitem__�si���|�|���<��9�9�4�4��)�)�$�-�-�8��1�1���g�e�n�
�
�>�>�$�'�3�3�E�:�:r8c��|j}|�Zt|jjt	j
|j�tj�j�S|j|�j�Sr9)re�lenr1rprrir_rrqr-rs�countrcs  r6r}zAppenderMixin.count�sk���|�|���<���	�	�1�1��-�-�d�m�m�<��5�5���+�	�
��>�>�$�'�-�-�/�/r8c���|j}|�Pt|�}|�Ctjdt	j
|��d|jj�d���|jr(|j|jj|��}n%|j|jj�}|j|_|j|_|j|_
|S)NzParent instance zh is not bound to a Session, and no contextual session is established; lazy load operation of attribute 'z' cannot proceed)re)r_r�orm_exc�DetachedInstanceErrorra�instance_strr1rMrCrF�query�_where_criteria�	_from_objrZ)r0rdr_r�s    r6rszAppenderMixin._generate�s����=�=���<�!�(�+�D��|��3�3� �,�,�X�6��	�	�
�
�G�������$�$�T�Y�Y�%<�%<�d�$�K�E��J�J�t�y�y�6�6�7�E� $� 4� 4����.�.���"&�"8�"8����r8c�&�|j|�y)a~Add an iterable of items to this :class:`_orm.AppenderQuery`.

        The given items will be persisted to the database in terms of
        the parent instance's collection on the next flush.

        This method is provided to assist in delivering forwards-compatibility
        with the :class:`_orm.WriteOnlyCollection` collection class.

        .. versionadded:: 2.0

        N��
_add_all_impl�r0�iterators  r6�add_allzAppenderMixin.add_all�s��	
���8�$r8c�(�|j|g�y)apAdd an item to this :class:`_orm.AppenderQuery`.

        The given item will be persisted to the database in terms of
        the parent instance's collection on the next flush.

        This method is provided to assist in delivering forwards-compatibility
        with the :class:`_orm.WriteOnlyCollection` collection class.

        .. versionadded:: 2.0

        Nr��r0�items  r6�addzAppenderMixin.add�s��	
���D�6�"r8c�&�|j|�y)z�Add an iterable of items to this :class:`_orm.AppenderQuery`.

        The given items will be persisted to the database in terms of
        the parent instance's collection on the next flush.

        Nr�r�s  r6�extendzAppenderMixin.extends��	
���8�$r8c�(�|j|g�y)z�Append an item to this :class:`_orm.AppenderQuery`.

        The given item will be persisted to the database in terms of
        the parent instance's collection on the next flush.

        Nr�r�s  r6�appendzAppenderMixin.appends��	
���D�6�"r8c�&�|j|�y)z�Remove an item from this :class:`_orm.AppenderQuery`.

        The given item will be removed from the parent instance's collection on
        the next flush.

        N)�_remove_implr�s  r6�removezAppenderMixin.removes��	
���$�r8)r1r:r2r;r<r=)r<�Optional[Session])rerr<r=)r<z1Union[result.ScalarResult[_T], result.Result[_T]])r<zIterator[_T])rzrr<zUnion[_T, List[_T]])r<�intr9)rdr�r<z	Query[_T])r�zIterable[_T]r<r=)r�r$r<r=)r>r?r@�__doc__rCrSr7�propertyre�setterrtrrvryr}rsr�r�r�r�r��
__classcell__)r]s@r6rIrIts�����.2�K�*�1�5�5�&�(�&�1B�&�	
�&�����
�^�^����0�2�/�;�
0�#'����
��:%�#�%�#� r8rIc��eZdZdZy)r)z�A dynamic query that supports basic collection storage operations.

    Methods on :class:`.AppenderQuery` include all methods of
    :class:`_orm.Query`, plus additional methods used for collection
    persistence.


    N)r>r?r@r�rAr8r6r)r)s��r8r)c�J�d|jz}t|t|fd|i�S)zAReturn a new class with AppenderQuery functionality layered over.�AppenderrC)r>�typerI)�cls�names  r6rKrK)s)������$�D���}�c�*�]�C�,@�A�Ar8N)r�rr<ztype[AppenderMixin[Any]])7r��
__future__r�typingrrrrrr	r
rrr
�rrrrrra�baserr�rrer�	writeonlyrrrr�enginerr�mapperrrrr2r r!�eventr"�sql.elementsr#r$r'r:�RelationshipProperty�strategy_forrWrIr)rKrAr8r6�<module>r�s���	�#�������� ���������#�/�-�'�&����$��6� �$�"�!�,��T����/�/��3�/�*=�1�=�:�#�#�0�0�i�0�@�&��&�A�&�g �,�R�0�g �T�M�"�%�u�R�y��Br8

ZeroDay Forums Mini