Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/__pycache__/properties.cpython-311.pyc

�

�܋f�1���dZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlmZdgZ
e
jGd
�de����ZdS)z|MapperProperty implementations.

This is a private module which defines the behavior of individual ORM-
mapped attributes.

�)�absolute_import�)�
attributes)�PropComparator)�StrategizedProperty)�_orm_full_deannotate�)�log)�util��
expression�ColumnPropertyc���eZdZdZdZdZejd����fd���Zej	dd��d	���Z
d
�Zed���Z
d�Z�fd
�Zd�Zejfd�Zd�ZGd�deje��Zd�Z�xZS)rz�Describes an object attribute that corresponds to a table column.

    Public constructor is the :func:`_orm.column_property` function.

    �column)�
_orig_columns�columns�group�deferred�
instrument�comparator_factory�
descriptor�	extension�active_history�expire_on_flush�info�doc�strategy_key�_creation_order�_is_polymorphic_discriminator�_mapped_by_synonym�_deferred_column_loader)z0.7z�:class:`.AttributeExtension` is deprecated in favor of the :class:`.AttributeEvents` listener interface.  The :paramref:`.column_property.extension` parameter will be removed in a future release.)rc
�F��tt|�����d�|D��|_d�|D��|_|�dd��|_|�dd��|_|�dd��|_|�d	|j	j
��|_|�d
d��|_|�dd��|_
|�dd��|_|�d
d��|_d|vr|�d��|_d|vr|�d��|_n:t%|j��D]}t'|dd��}|�	||_n�d|_|rPt)|j	j�dd�t/|������������t3j|��d|jfd|jff|_dS)a�
Provide a column-level property for use with a mapping.

        Column-based properties can normally be applied to the mapper's
        ``properties`` dictionary using the :class:`_schema.Column`
        element directly.
        Use this function when the given column is not directly present within
        the mapper's selectable; examples include SQL expressions, functions,
        and scalar SELECT queries.

        The :func:`_orm.column_property` function returns an instance of
        :class:`.ColumnProperty`.

        Columns that aren't present in the mapper's selectable won't be
        persisted by the mapper and are effectively "read-only" attributes.

        :param \*cols:
              list of Column objects to be mapped.

        :param active_history=False:
          When ``True``, indicates that the "previous" value for a
          scalar attribute should be loaded when replaced, if not
          already loaded. Normally, history tracking logic for
          simple non-primary-key scalar values only needs to be
          aware of the "new" value in order to perform a flush. This
          flag is available for applications that make use of
          :func:`.attributes.get_history` or :meth:`.Session.is_modified`
          which also need to know
          the "previous" value of the attribute.

        :param comparator_factory: a class which extends
           :class:`.ColumnProperty.Comparator` which provides custom SQL
           clause generation for comparison operations.

        :param group:
            a group name for this property when marked as deferred.

        :param deferred:
              when True, the column property is "deferred", meaning that
              it does not load immediately, and is instead loaded when the
              attribute is first accessed on an instance.  See also
              :func:`~sqlalchemy.orm.deferred`.

        :param doc:
              optional string that will be applied as the doc on the
              class-bound descriptor.

        :param expire_on_flush=True:
            Disable expiry on flush.   A column_property() which refers
            to a SQL expression (and not a single table-bound column)
            is considered to be a "read only" property; populating it
            has no effect on the state of data, and it can only return
            database state.   For this reason a column_property()'s value
            is expired whenever the parent object is involved in a
            flush, that is, has any kind of "dirty" state within a flush.
            Setting this parameter to ``False`` will have the effect of
            leaving any existing value present after the flush proceeds.
            Note however that the :class:`.Session` with default expiration
            settings still expires
            all attributes after a :meth:`.Session.commit` call, however.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.MapperProperty.info` attribute of this object.

        :param extension:
            an :class:`.AttributeExtension` instance, or list of extensions,
            which will be prepended to the list of attribute listeners for the
            resulting descriptor placed on the class.

        .. seealso::

            :ref:`column_property_options` - to map columns while including
            mapping options

            :ref:`mapper_column_property_sql_expressions` - to map SQL
            expressions

        c�6�g|]}tj|����S�)r
�_labeled��.0�cs  �P/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/properties.py�
<listcomp>z+ColumnProperty.__init__.<locals>.<listcomp>�s#��F�F�F��j�1�!�4�4�F�F�F�c�P�g|]#}tjt|������$Sr$)r
r%rr&s  r)r*z+ColumnProperty.__init__.<locals>.<listcomp>�s9��
�
�
�=>�J�� 4�Q� 7� 7�8�8�
�
�
r+rNrF�_instrumentTrrrrrrrz* received unexpected keyword argument(s): z, r)�superr�__init__rr�poprrr�	__class__�
Comparatorrrrrrrr�reversed�getattr�	TypeError�__name__�join�sorted�keysr�set_creation_orderr)�selfr�kwargs�colrr1s     �r)r/zColumnProperty.__init__:s ���n	�n�d�#�#�,�,�.�.�.�F�F�g�F�F�F���
�
�BI�
�
�
����Z�Z���.�.��
��
�
�:�u�5�5��
� �*�*�]�D�9�9���"(�*�*� �$�.�";�#
�#
���!�*�*�\�4�8�8������K��6�6���$�j�j�)9�5�A�A���%�z�z�*;�T�B�B����V����
�
�6�*�*�D�I��F�?�?��z�z�%�(�(�D�H�H����-�-�
 �
 ���c�5�$�/�/���?�"�D�H��E�#� ����	���>�*�*�*�D�I�I�f�V�[�[�]�]�6K�6K�,L�,L�,L�N���
�
	
���%�%�%����'�
�4�?�+�
����r+zsqlalchemy.orm.statezsqlalchemy.orm.strategiesc��|j�|jj|�|j��|j��S�N)�
InstanceState�"_instance_level_callable_processor�parent�
class_manager�LoadDeferredColumns�key)r;�state�
strategiess   r)�&_memoized_attr__deferred_column_loaderz5ColumnProperty._memoized_attr__deferred_column_loader�s=���"�E�E��K�%��*�*�4�8�4�4��H�
�
�	
r+c��|jS)zsAllow the ColumnProperty to work in expression before it is turned
        into an instrumented attribute.
        r�r;s r)�__clause_element__z!ColumnProperty.__clause_element__�s��
��r+c��|jdS)a�Return the primary column or expression for this ColumnProperty.

        E.g.::


            class File(Base):
                # ...

                name = Column(String(64))
                extension = Column(String(8))
                filename = column_property(name + '.' + extension)
                path = column_property('C:/' + filename.expression)

        .. seealso::

            :ref:`mapper_column_property_sql_expressions_composed`

        r)rrJs r)r
zColumnProperty.expression�s��(�|�A��r+c��|jsdStj|j|j|�||��||j���dS)N)�
comparator�parententityr)rr�register_descriptor�class_rErr)r;�mappers  r)�instrument_classzColumnProperty.instrument_class�sZ����	��F��&��M��H��.�.�t�V�<�<����	
�	
�	
�	
�	
�	
r+c�r��tt|�����t|j��dkrtt|jj���|j��rEtj
d|j�d|jd�d|jd�d|j�d�	��dSdSdS)Nrz
On mapper z, primary key column 'z6' is being combined with distinct primary key column 'rz' in attribute 'zM'. Use explicit properties to give each column its own mapped attribute name.)r.r�do_init�lenr�setrB�primary_key�
issupersetr�warnrE)r;r1s �r)rUzColumnProperty.do_init�s����
�n�d�#�#�+�+�-�-�-��t�|���q� � �S���)@�%A�%A�%L�%L��L�&
�&
� �
�I�I��;�;�;���Q������a����$�(�(�(�
L�
�
�
�
�
�!� � � r+c�F�t|j|j|j|jd��S)N)rrr)rrrrrrJs r)�copyzColumnProperty.copy�s2����\��]��*��.�
�
�
�	
r+c�b�|�|j���|||���S)N)�passive)�get_implrE�get_committed_value)r;rF�dict_rr^s     r)�
_getcommittedzColumnProperty._getcommitteds6���~�~�d�h�'�'�;�;��5�'�<�
�
�	
r+c	�,�|jsdS|j|vrO||j}	|s|	||j<dS|�|j��}
|
�|||	d��dS|jr)|j|vr"|�||jgd���dSdSdS)NT)�	no_loader)rrEr_rW�has_identity�_expire_attributes)r;�session�source_state�source_dict�
dest_state�	dest_dict�load�
_recursive�_resolve_conflict_map�value�impls           r)�mergezColumnProperty.merges�����
	��F�
�X��
$�
$����)�E��
=�&+�	�$�(�#�#�#�!�*�*�4�8�4�4������Y��t�<�<�<�<�<�
�
$�	����)B�)B��)�)��D�H�:��
*�
�
�
�
�
�	�	�)B�)Br+c�:�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�ColumnProperty.Comparatora�Produce boolean, comparison, and other operators for
        :class:`.ColumnProperty` attributes.

        See the documentation for :class:`.PropComparator` for a brief
        overview.

        .. seealso::

            :class:`.PropComparator`

            :class:`.ColumnOperators`

            :ref:`types_operators`

            :attr:`.TypeEngine.comparator_factory`

        )rKr�expressionsc��|jr%|�|jjd��S|jjd�|j|jd���S)Nr)rO�parentmapper)�adapter�propr�	_annotate�
_parententityrJs r)�#_memoized_method___clause_element__z=ColumnProperty.Comparator._memoized_method___clause_element__:sb���|�

��|�|�D�I�$5�a�$8�9�9�9��y�(��+�5�5�(,�(:�(,�(:�����r+c�r�|���}	|jS#t$r|jjcYSwxYw)z(The .info dictionary for this attribute.)rKr�AttributeErrorrx)r;�ces  r)�_memoized_attr_infoz-ColumnProperty.Comparator._memoized_attr_infoGsL���(�(�*�*�B�
&��w���!�
&�
&�
&��y�~�%�%�%�
&���s��6�6c�r���jr�fd��jjD��S�fd��jjD��S)z�The full sequence of columns referenced by this
            attribute, adjusted for any aliasing in progress.

            .. versionadded:: 1.3.17

            c�:��g|]}��|����Sr$)rw�r'r=r;s  �r)r*zHColumnProperty.Comparator._memoized_attr_expressions.<locals>.<listcomp>Xs%���G�G�G�c����S�)�)�G�G�Gr+c�j��g|]/}|��j�j�jjd�����0S))rOrv�orm_key)ryrzrxrEr�s  �r)r*zHColumnProperty.Comparator._memoized_attr_expressions.<locals>.<listcomp>\sV���	�	�	���M�M�,0�,>�,0�,>�'+�y�}�����	�	�	r+)rwrxrrJs`r)�_memoized_attr_expressionsz4ColumnProperty.Comparator._memoized_attr_expressionsPs`����|�
�G�G�G�G�T�Y�5F�G�G�G�G�	�	�	�	� $�y�0�	�	�	�	r+c�F�t|���|��S)z�proxy attribute access down to the mapped column.

            this allows user-defined comparison methods to be accessed.
            )r4rK)r;rEs  r)�_fallback_getattrz+ColumnProperty.Comparator._fallback_getattrgs ��
�4�2�2�4�4�c�:�:�:r+c�>�||���g|�Ri|��Sr?)rK)r;�op�otherr<s    r)�operatez!ColumnProperty.Comparator.operatens.���2�d�-�-�/�/�B�%�B�B�B�6�B�B�Br+c�f�|���}||�||��|fi|��Sr?)rK�_bind_param)r;r�r�r<r=s     r)�reverse_operatez)ColumnProperty.Comparator.reverse_operateqs;���)�)�+�+�C��2�c�o�o�b�%�0�0�#�@�@��@�@�@r+N)r6�
__module__�__qualname__�__doc__�	__slots__r{rr�r�r�r�r$r+r)r2rs%s�������	�	�$@�	�	�	�	�	&�	&�	&�	�	�	�.	;�	;�	;�	C�	C�	C�	A�	A�	A�	A�	Ar+r2c�T�t|jjj��dz|jzS)N�.)�strrBrQr6rErJs r)�__str__zColumnProperty.__str__us$���4�;�%�.�/�/�#�5���@�@r+)r6r�r�r��strategy_wildcard_keyr�r�deprecated_paramsr/�dependenciesrHrK�propertyr
rSrUr\r�PASSIVE_OFFrbrq�
MemoizedSlotsrr2r��
__classcell__)r1s@r)rrs����������%���I�(�T��
����w
�w
�w
�w
���w
�r�T��-�/J�K�K�
�
�L�K�
��������X��*

�

�

�
�
�
�
�
�
�
�
�-7�,B�
�
�
�
����4NA�NA�NA�NA�NA�T�'��NA�NA�NA�`A�A�A�A�A�A�Ar+N)r��
__future__r�r�
interfacesrrrrr
�sqlr
�__all__�class_loggerrr$r+r)�<module>r�s����'�&�&�&�&�&�������&�&�&�&�&�&�+�+�+�+�+�+�&�&�&�&�&�&��������������������
����YA�YA�YA�YA�YA�(�YA�YA���YA�YA�YAr+

Hacked By AnonymousFox1.0, Coded By AnonymousFox