Hacked By AnonymousFox

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

�

�܋f1���dZddlZddlmZddlmZddlmZddlmZddlmZdd	l	m
Z
dd
l	mZddl	mZddl
mZe��Zd
�ZGd�de��ZGd�de��ZGd�de��ZGd�de��Zeje��d���Gd�de��Zd�ZGd�de��Zd�Zd�ZdS)z�Routines to handle the string class registry used by declarative.

This system allows specification of classes and expressions used in
:func:`_orm.relationship` using strings.

�N�)�exc)�
inspection)�util)�class_mapper)�
interfaces)�ColumnProperty)�RelationshipProperty)�SynonymProperty)�_get_table_keyc��||jvr>|j|}t|t��st||g��x}|j|<n
||j|<	|jd}n*#t$rt	dd��x|jd<}YnwxYw|j�d��}|r^|�d��}|�|��}|D]}|�|��}�|�	||��|�\dSdS)z^Add a class to the _decl_class_registry associated with the
    given declarative class.

    �_sa_module_registryN�.r)
�_decl_class_registry�
isinstance�_MultipleClassMarker�KeyError�
_ModuleMarker�
__module__�split�pop�
get_module�	add_class)�	classname�cls�existing�root_module�tokens�token�modules       �]/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/ext/declarative/clsregistry.pyrr!sa��
�C�,�,�,��+�I�6���(�$8�9�9�	6�%�c�8�_�5�5�
6�H�s�/����/2�� ��+�E��.�/D�E�����E�E�E�(�(=�t�D�D�	E�� �!�	
��K�K�E����
�^�
!�
!�#�
&�
&�F��)��
�
�1�
�
���'�'��.�.���	.�	.�E��&�&�u�-�-�F�F�����C�(�(�(��)�)�)�)�)s�
A!�!$B�Bc�6�eZdZdZdZd	d�Zd�Zd�Zd�Zd�Z	dS)
rzRrefers to multiple classes of the same name
    within _decl_class_registry.

    )�	on_remove�contents�__weakref__Nc���|�_t�fd�|D�����_t����dS)Nc�D��g|]}tj|�j����S�)�weakref�ref�_remove_item)�.0�item�selfs  �r!�
<listcomp>z1_MultipleClassMarker.__init__.<locals>.<listcomp>Ts(���F�F�F�d�W�[��t�0�
1�
1�F�F�F�)r#�setr$�_registries�add)r.�classesr#s`  r!�__init__z_MultipleClassMarker.__init__QsL���"����F�F�F�F�g�F�F�F�
�
��
�	��������r0c�$�d�|jD��S)Nc3�*K�|]}|��V��dS�Nr(�r,r*s  r!�	<genexpr>z0_MultipleClassMarker.__iter__.<locals>.<genexpr>Ys(����/�/�#�����/�/�/�/�/�/r0�r$)r.s r!�__iter__z_MultipleClassMarker.__iter__Xs��/�/���/�/�/�/r0c��t|j��dkr.tjdd�||gz��z���t|j��d}|��}|�t
|���|S)N�zxMultiple classes found for path "%s" in the registry of this declarative base. Please use a fully module-qualified path.rr)�lenr$r�InvalidRequestError�join�list�	NameError)r.�path�keyr*rs     r!�attempt_getz _MultipleClassMarker.attempt_get[s����t�}����!�!��)�B��8�8�D�C�5�L�)�)�+���
��t�}�%�%�a�(�C��#�%�%�C��{���n�n�$��Jr0c��|j�|��|js7t�|��|jr|���dSdSdSr8)r$�remover2�discardr#)r.r*s  r!r+z!_MultipleClassMarker._remove_itemjsj���
���S�!�!�!��}�	!�����%�%�%��~�
!���� � � � � �	!�	!�
!�
!r0c��td�d�|jD��D����}|j|vr%tjd|j�d|j�d���|j�tj||j	����dS)Nc� �g|]}|�|j��Sr8)r)r,rs  r!r/z1_MultipleClassMarker.add_item.<locals>.<listcomp>vs'��
�
�
���?���"�?�?r0c�"�g|]}|����
Sr(r(r9s  r!r/z1_MultipleClassMarker.add_item.<locals>.<listcomp>xs��;�;�;�c�C�C�E�E�;�;�;r0z[This declarative base already contains a class with the same class name and module name as rz2, and will be replaced in the string-lookup table.)
r1r$rr�warn�__name__r3r)r*r+)r.r-�moduless   r!�add_itemz_MultipleClassMarker.add_itemqs����
�
�;�;�T�]�;�;�;�
�
�
�
�
���?�g�%�%��I�I��?�?�?�D�M�M�M�3�
�
�
�	
�
���'�+�d�D�,=�>�>�?�?�?�?�?r0r8)
rNr�__qualname__�__doc__�	__slots__r5r<rFr+rPr(r0r!rrIsz��������
7�I�����0�0�0�
�
�
�!�!�!�@�@�@�@�@r0rc�@�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)rz>Refers to a module name within
    _decl_class_registry.

    )�parent�namer$�mod_nsrDr%c���||_||_i|_t|��|_|jr|jj|jgz|_ng|_t�|��dSr8)rUrVr$�_ModNSrWrDr2r3)r.rVrUs   r!r5z_ModuleMarker.__init__�sd�������	���
��T�l�l����;�	���(�D�I�;�6�D�I�I��D�I���������r0c��||jvSr8r;�r.rVs  r!�__contains__z_ModuleMarker.__contains__�s���t�}�$�$r0c��|j|Sr8r;r[s  r!�__getitem__z_ModuleMarker.__getitem__�s���}�T�"�"r0c���|j�|d��|jsB|j�=|j�|j��t
�|��dSdSdSr8)r$rrUr+rVr2rIr[s  r!r+z_ModuleMarker._remove_item�sm���
���$��%�%�%��}�	&���!8��K�$�$�T�Y�/�/�/�����%�%�%�%�%�	&�	&�!8�!8r0c�,�t|j|��Sr8)�getattrrW�r.rEs  r!�resolve_attrz_ModuleMarker.resolve_attr�s���t�{�C�(�(�(r0c�h�||jvrt||��}||j|<n
|j|}|Sr8)r$r)r.rV�markers   r!rz_ModuleMarker.get_module�s>���t�}�$�$�"�4��.�.�F�"(�D�M�$����]�4�(�F��
r0c������jvr$�j�}|�|��dSt|g��fd����x}�j�<dS)Nc�.�������Sr8)r+)rVr.s��r!�<lambda>z)_ModuleMarker.add_class.<locals>.<lambda>�s����):�):�4�)@�)@�r0)r#)r$rPr)r.rVrrs``  r!rz_ModuleMarker.add_class�ss�����4�=� � ��}�T�*�H����c�"�"�"�"�"�-A���!@�!@�!@�!@�!@�.�.�.�
�H�t�}�T�*�*�*r0N)rNrrQrRrSr5r\r^r+rcrrr(r0r!rr�s���������
N�I�	�	�	�%�%�%�#�#�#�&�&�&�)�)�)��������r0rc��eZdZdZd�Zd�ZdS)rY)�__parentc��||_dSr8)�_ModNS__parent)r.rUs  r!r5z_ModNS.__init__�s
����
�
�
r0c�2�	|jj|}|�St|t��r|jSt|t
��sJ�|�|jj|��Sn#t$rYnwxYwtd|jj
�d|�����)NzModule z1 has no mapped classes registered under the name )rlr$rrrWrrFrDr�AttributeErrorrV)r.rE�values   r!�__getattr__z_ModNS.__getattr__�s���
	F��M�*�3�/�E�� ��e�]�3�3�F� �<�'�%�e�-A�B�B�B�B�B� �,�,�T�]�-?��E�E�E�!���	�	�	��D�	�����n�.2�m�.@�.@�.@�#�#�
G�
�
�	
s�A*�*
A7�6A7N�rNrrQrSr5rpr(r0r!rYrY�s7�������I����
�
�
�
�
r0rYc��eZdZdZd�Zd�ZdS)�_GetColumns�rc��||_dSr8rt)r.rs  r!r5z_GetColumns.__init__�s
������r0c��t|jd���}|r�||jvrtjd|j�d|�����|j|}|jtjurP|j}t|t��r|j}n,t|t��stjd|z���t|j|��S)NF)�	configurezClass z% does not have a mapped column named zaProperty %r is not an instance of ColumnProperty (i.e. does not correspond directly to a Column).)rr�all_orm_descriptorsrr@�extension_typer�
NOT_EXTENSION�propertyrrrVr	ra)r.rE�mp�desc�props     r!rpz_GetColumns.__getattr__�s���
�$�(�e�
4�
4�
4��
�	��"�0�0�0��-�-��x�x�x���&����
�)�#�.�D��"�j�&>�>�>��}���d�O�4�4���)�C�C�#�D�.�9�9���1�2�47�8����
�t�x��%�%�%r0Nrqr(r0r!rsrs�s7�������I����&�&�&�&�&r0rsc�4�tj|j��Sr8)r�inspectr)�targets r!rhrh�s��:�%�f�j�1�1�r0c��eZdZdZd�Zd�ZdS)�	_GetTable�rE�metadatac�"�||_||_dSr8r�)r.rEr�s   r!r5z_GetTable.__init__�s����� ��
�
�
r0c�L�|jjt||j��Sr8)r��tablesrrErbs  r!rpz_GetTable.__getattr__�s���}�#�N�3���$A�$A�B�Br0Nrqr(r0r!r�r��s<������!�I�!�!�!�C�C�C�C�Cr0r�c�v�t|t��r|�g|��}t|��Sr8)rrrFrs)rEros  r!�_determine_containerr��s8���%�-�.�.�+��!�!�"�c�*�*���u���r0c�.�eZdZdd�Zd�Zd�Zd�Zd�ZdS)	�_class_resolverFc��||_||_|x|_|_||_tj|j��|_d|_	||_
dS)Nr()rr~�arg�_declarative_arg�fallbackr�PopulateDict�_access_cls�_dict�
_resolvers�favor_tables)r.rr~r�r�r�s      r!r5z_class_resolver.__init__sP�������	�+.�.���4�(� ��
��&�t�'7�8�8��
����(����r0c�R�|j}|jrC||jjvr|jj|S||jjvrt||j��S||jvrt||j|��S|jsC||jjvr|jj|S||jjvrt||j��Sd|jvr1||jdvr"|jd}|�|��S|j	r|j	D]}||��}|�|cS�|j
|S)Nr)rr�r�r��_schemasr�rr�rcr�r�)r.rEr�registry�resolvros      r!r�z_class_resolver._access_clssZ���h����	4��c�l�)�)�)��|�*�3�/�/����-�-�-� ��c�l�3�3�3��#�*�*�*�'��S�-E�c�-J�K�K�K�� �	4��c�l�)�)�)��|�*�3�/�/����-�-�-� ��c�l�3�3�3�
"�S�%=�=�=��s�/�0E�F�F�F��/�0E�F�H��(�(��-�-�-�
�_�	!��/�
!�
!����s�����$� �L�L�L�%��}�S�!�!r0c
��tjtjd|jj�d|j�d|�d|j�d�	��|���dS)NzWhen initializing mapper z
, expression z failed to locate a name (zG). If this is a class name, consider adding this relationship() to the z6 class after both dependent classes have been defined.)�from_)r�raise_rr@r~rUr�r)r.rV�errs   r!�_raise_for_namez_class_resolver._raise_for_name/sh�����#�#�
�9�#�#�#�T�X�X�X�t�t�t�T�X�X�X�	?�
�
��		
�		
�		
�		
�		
�		
r0c��|j}|j}d}	|�d��D]}|�	||}�
t||��}�	t	|t
��r|jS|S#t$r!}|�||��Yd}~dSd}~wt$r,}|�|j
d|��Yd}~dSd}~wwxYw)Nrr)r�r�rrarrsrrr�rC�args)r.rV�d�rvalrr��ns       r!�
_resolve_namez_class_resolver._resolve_name;s���x���J����	����C���
0�
0���<��U�8�D�D�"�4��/�/�D�D�	
0��$��,�,�
��x������	,�	,�	,�� � ��s�+�+�+�+�+�+�+�+�+������	/�	/�	/�� � �����A�.�.�.�.�.�.�.�.�.�����	/���s#�3A$�$
C�.B
�

C�!B>�>Cc��	t|jt��|j��}t	|t
��r|jS|S#t$r,}|�|j	d|��Yd}~dSd}~wwxYw)Nr)
�evalr��globalsr�rrsrrCr�r�)r.�xr�s   r!�__call__z_class_resolver.__call__Os���	/��T�X�w�y�y�$�*�5�5�A��!�[�)�)�
��u������	/�	/�	/�� � �����A�.�.�.�.�.�.�.�.�.�����	/���s�AA�A�
A=�!A8�8A=N�F)rNrrQr5r�r�r�r�r(r0r!r�r�se������)�)�)�)�"�"�"�@

�

�

����(	/�	/�	/�	/�	/r0r�c�����ddl}ddlm}m}|j������||d���d���fd�	}���fd�}||fS)Nr)�foreign�remoteFc�,��t���||���S)N�r�)r�)r�r�rr�r~s  ���r!�resolve_argz_resolver.<locals>.resolve_argbs%������x��<�
�
�
�	
r0c�2��t���|��jSr8)r�r�)r�rr�r~s ���r!�resolve_namez_resolver.<locals>.resolve_namegs����s�D�(�C�8�8�F�Fr0r�)�
sqlalchemy�sqlalchemy.ormr�r��__dict__�copy�update)rr~r�r�r�r�r�r�s``     @r!�	_resolverr�[s����������.�.�.�.�.�.�.�.��"�'�'�)�)�H��O�O��6�:�:�;�;�;�
�
�
�
�
�
�
�
�
G�G�G�G�G�G�G���$�$r0c
�X�t|t���rt||��\}}dD]L}t||��}t|tj��r t
|||||dk������MdD]F}t||��}t|tj��rt
||||�����G|jrat|jt��rG|j\}}dD]:}||vr4t||tj��r|||��||<�;|S)N)�order_by�primaryjoin�
secondaryjoin�	secondary�_user_defined_foreign_keys�remote_sider�r�)�argument)r�r�r��foreign_keysr�r�)	rr
r�rar�string_types�setattr�backref�tuple)rr~r�r��attr�vrE�kwargss        r!�_deferred_relationshipr�ms]���$�,�-�-�%=�$-�c�4�$8�$8�!��k�
�	�	�D���d�#�#�A��!�T�.�/�/�
�����K����0C�D�D�D�����"�	5�	5�D���d�#�#�A��!�T�.�/�/�
5���d�L�L��O�O�4�4�4���<�
	=�J�t�|�U�;�;�
	=��,�K�C���
=�
=���6�>�>�j��4�L�$�"3�'�'�>�$/�;�v�d�|�#<�#<�F�4�L���Kr0)rRr)�rrr�ormrr�orm.propertiesr	r
r�schemarr1r2r�objectrrrYrs�	_inspectsr�r�r�r�r�r(r0r!�<module>r�sQ��������������������������������������,�,�,�,�,�,�2�2�2�2�2�2�-�-�-�-�-�-�$�$�$�$�$�$��c�e�e��%)�%)�%)�P:@�:@�:@�:@�:@�6�:@�:@�:@�z1�1�1�1�1�F�1�1�1�h
�
�
�
�
�V�
�
�
�0&�&�&�&�&�&�&�&�&�:"��
��[�!�!�1�1����
C�C�C�C�C��C�C�C����S/�S/�S/�S/�S/�f�S/�S/�S/�l%�%�%�$)�)�)�)�)r0

Hacked By AnonymousFox1.0, Coded By AnonymousFox