Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/engine/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/engine/__pycache__/strategies.cpython-311.pyc

�

�܋fw&��6�dZddlmZddlmZddlmZddlmZddlmZdd	lmZ	dd
lm
Z
ddlmZiZ
Gd�d
e��ZGd�de��ZGd�de��Ze��Gd�de��Ze��Gd�de��Ze��dS)aqStrategies for creating new instances of Engine types.

These are semi-private implementation classes which provide the
underlying behavior for the "strategy" keyword argument available on
:func:`~sqlalchemy.engine.create_engine`.  Current available options are
``plain``, ``threadlocal``, and ``mock``.

New strategies can be added via new ``EngineStrategy`` classes.
�)�
attrgetter�)�base)�threadlocal)�url�)�event)�pool)�util)�schemac��eZdZdZd�Zd�ZdS)�EngineStrategyz�An adaptor that processes input arguments and produces an Engine.

    Provides a ``create`` method that receives input arguments and
    produces an instance of base.Engine or a subclass.

    c�$�|t|j<dS�N)�
strategies�name)�selfs �S/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/engine/strategies.py�__init__zEngineStrategy.__init__(s�� $�
�4�9����c��t���)z/Given arguments, returns a new Engine instance.��NotImplementedError)r�args�kwargss   r�createzEngineStrategy.create+s��"�#�#�#rN)�__name__�
__module__�__qualname__�__doc__rr�rrrr s<��������%�%�%�$�$�$�$�$rrc��eZdZdZd�ZdS)�DefaultEngineStrategyz#Base class for built-in strategies.c����������tj|��}|����}|j�dd����dd��|���}|�|�����dd��rd%��fd�	}n�j}i}tj���D]}|�vr||��||<���dd��}	|	�=i}
tj	�j
��D]}|�vr||��|
|<��j
d&i|
��}	|	|d<|D]}|��|����d&i|�����|��\����
|di����t����|d	d��}|��d%���fd
�	}
|d|
��}|dd��}|���|��}d
�i}dddddddddd�	}tj|��D]*}|�||��}|�vr||��||<�+|D]}|�||���||fi|��}n6t%|t&jj��r|j�i���}n|}�|_|j}i}tj|��D]}|�vr||��||<���dd��}�rRt3dd�d��D�����d�jj�d|jj�d|j�d�	���||�|fi|���|re������r1�fd �}t=j|d!|��t=j|d"|����fd#�}t=j|d!|d�$���� ���|�ur|� ���|D]}|� �����S)'N�plugin�plugins�_coerce_configFc�r����||��}|�jvr�j||��}|Sr)�pop�engine_config_types)�key�default�value�dialect_clsrs   ��r�	pop_kwargz/DefaultEngineStrategy.create.<locals>.pop_kwargBs@����
�
�3��0�0���+�9�9�9�@�K�;�C�@��G�G�E��r�module�dbapi�connect_argsr
c�r���jr#�jjD]}|�|����}|�|cS��j�i���Sr)�_has_events�dispatch�
do_connect�connect)�connection_record�fn�
connection�cargs�cparams�dialects   ���rr7z-DefaultEngineStrategy.create.<locals>.connectjsn����&�.�%�.�9�.�.��%'�R�#�%6��w�&�&�
�&�1�#-�-�-�-�2�&�w���9��9�9�9r�creator�	poolclassr=�pool_logging_name�	echo_pool�pool_timeout�pool_recycle�pool_events�pool_threadlocal�pool_reset_on_return�
pool_pre_ping�
pool_use_lifo)	�logging_name�echo�timeout�recycle�events�use_threadlocal�reset_on_return�pre_ping�use_lifo�_initializeTzInvalid argument(s) �,c3� K�|]	}d|zV��
dS)z'%s'Nr!)�.0�ks  r�	<genexpr>z/DefaultEngineStrategy.create.<locals>.<genexpr>�s&����8�8�A�V�a�Z�8�8�8�8�8�8rz. sent to create_engine(), using configuration �/z^.  Please check that the keyword arguments are appropriate for this combination of components.c�H��t|d|��}|�dS�|��dS)N�_sqla_unwrap)�getattr)�dbapi_connectionr8�conn�
do_on_connects   �r�
on_connectz0DefaultEngineStrategy.create.<locals>.on_connect�s<���"�(�.�:J���D��|���!�M�$�'�'�'�'�'r�
first_connectr7c����tj�|d���}tj��|_��|����|j��dS)NF)r:r4)r�
Connectionr�
immutabledict�_execution_options�
initialize�do_rollbackr:)r\r8�cr=�engines   ��rr`z3DefaultEngineStrategy.create.<locals>.first_connect�sd����O��'7�U�����(,�'9�';�';��$��"�"�1�%�%�%��#�#�A�L�1�1�1�1�1r)�_once_unless_exceptionrr!)!r�make_url�_instantiate_plugins�queryr)�_get_entrypoint�get_dialect_clsr�get_cls_kwargs�get_func_kwargsr1�handle_dialect_kwargs�create_connect_args�update�list�get_pool_class�get�handle_pool_kwargs�
isinstance�poollib�dbapi_proxy�_DBProxy�get_pool�_dialect�
engine_cls�	TypeError�join�	__class__rr_r	�listen�engine_created)r�name_or_urlr�ur&�
entrypointr/�dialect_argsrVr1�
dbapi_argsr%r
r7r>r?�	pool_args�	translate�tk�engineclass�engine_argsrRr_r`r;r<r=r.r^rhs  `                     @@@@@@rrzDefaultEngineStrategy.create4s]����������L��%�%���(�(��0�0��	����H�d�#�#�#��
�
�9�d�#�#�#��&�&�(�(�
� �0�0��3�3���:�:�&��.�.�		#�
�
�
�
�
�
�
�
��
�I����$�[�1�1�	/�	/�A��F�{�{�"+�)�A�,�,��Q����
�
�8�T�*�*���=��J��)�+�*;�<�<�
1�
1����;�;�$-�I�a�L�L�J�q�M��%�K�%�3�3�
�3�3�E� %��W���	D�	D�F��(�(��l�C�C�C�C��+�-�-��-�-��#�6�6�q�9�9�������y�y���4�4�5�5�5��U�����y���&�&���<�
:�
:�
:�
:�
:�
:�
:�
:� �i�	�7�3�3�G�!�	�+�t�4�4�I�� �'�6�6�q�9�9�	�"�G�,�I�
!4�#�)�)�'�#5�#9�+�+�
�
�I��(��3�3�
1�
1���]�]�1�a�(�(����<�<�#,�9�R�=�=�I�a�L��!�
@�
@���)�)�)�Y�?�?�?�?��9�W�2�2�	�2�2�D�D��$�� 3� <�=�=�
�$�t�}�e�7�w�7�7�����#�D�M��o�����$�[�1�1�	.�	.�A��F�{�{�!*��1����A����j�j���5�5���	��)��H�H�8�8��8�8�8�8�8�8�8��%�.�.�.��N�+�+�+��(�(�(�	���
���T�7�A�=�=��=�=���	�#�.�.�0�0�M��
:�(�(�(�(�(���T�?�J�?�?�?���T�9�j�9�9�9�
2�
2�
2�
2�
2�
2�
�L����'+�	
�
�
�
�	�"�"�6�*�*�*��[�(�(��%�%�f�-�-�-��	*�	*�F��!�!�&�)�)�)�)��
rN)rrrr rr!rrr#r#1s.������-�-�d�d�d�d�drr#c�$�eZdZdZdZejZdS)�PlainEngineStrategyz*Strategy for configuring a regular Engine.�plainN)rrrr rr�Enginer~r!rrr�r��s ������4�4��D���J�J�Jrr�c�$�eZdZdZdZejZdS)�ThreadLocalEngineStrategyz=Strategy for configuring an Engine with threadlocal behavior.rN)rrrr rr�TLEnginer~r!rrr�r��s!������G�G��D��%�J�J�Jrr�c�B�eZdZdZdZd�ZGd�dej��ZdS)�MockEngineStrategyz�Strategy for configuring an Engine-like object with mocked execution.

    Produces a single mock Connectable object which dispatches
    statement execution to a passed-in function.

    �mockc��tj|��}|���}i}tj|��D]}||vr|�|��||<�|di|��}t�||��S)Nr!)rrj�get_dialectrror)r��MockConnection)	rr��executorrr�r.r�rVr=s	         rrzMockEngineStrategy.create�s����L��%�%���m�m�o�o�����$�[�1�1�	0�	0�A��F�{�{�"(�*�*�Q�-�-��Q����+�-�-��-�-��!�0�0��(�C�C�Crc��eZdZd�Zed���Zeed����Zed���Ze	j
d��Zd�Zd�Z
d�Zd	�Zd
�Zd�Z	dd�Zd
�ZdS)�!MockEngineStrategy.MockConnectionc�"�||_||_dSr)r}�execute)rr=r�s   rrz*MockEngineStrategy.MockConnection.__init__s��#�D�M�"�D�L�L�Lrc��|Srr!��ss r�<lambda>z*MockEngineStrategy.MockConnection.<lambda>s��A�rr}c��|jjSr)r}rr�s rr�z*MockEngineStrategy.MockConnection.<lambda>s
��!�*�/�rNc��|Srr!�rrs  r�contextual_connectz4MockEngineStrategy.MockConnection.contextual_connect����Krc��|Srr!r�s  rr7z)MockEngineStrategy.MockConnection.connectr�rc��|Srr!)r�kws  r�execution_optionsz3MockEngineStrategy.MockConnection.execution_optionsr�rc�.�|jj||fd|i|��S)Nrh)r}�compiler)r�	statement�
parametersrs    rr�z*MockEngineStrategy.MockConnection.compilers5��)�4�=�)��:���.2��6<���
rc�j�d|d<ddlm}|j|j|fi|���|��dS�NF�
checkfirstr)�ddl)�sqlalchemy.enginer��SchemaGeneratorr=�traverse_single�r�entityrr�s    rrz(MockEngineStrategy.MockConnection.create#s\��#(�F�<� �-�-�-�-�-�-��C����d�=�=�f�=�=�M�M��
�
�
�
�
rc�j�d|d<ddlm}|j|j|fi|���|��dSr�)r�r��
SchemaDropperr=r�r�s    r�dropz&MockEngineStrategy.MockConnection.drop+s\��#(�F�<� �-�-�-�-�-�-��C��d�l�D�;�;�F�;�;�K�K��
�
�
�
�
rc�T�d|d<||j|fi|���|��dS)NFr�)r=r�)r�visitorcallable�elementr:rs     r�_run_visitorz.MockEngineStrategy.MockConnection._run_visitor3sI��$)�F�<� ��O�D�L�$�9�9�&�9�9�I�I��
�
�
�
�
rc��t���rr)r�object_�multiparams�paramss    rr�z)MockEngineStrategy.MockConnection.execute;s��%�'�'�'rr)rrrr�propertyrhrr=rr�_schema_getter�schema_for_objectr�r7r�r�rr�r�r�r!rrr�r�
s�������	#�	#�	#���+�+�&�&���(�:�:�j�1�1�2�2���x�1�1�2�2��1�F�1�$�7�7��	�	�	�	�	�	�	�	�	�	�	�	�
	�	�	�	�	�	�8<�	�	�	�	�	(�	(�	(�	(�	(rr�N)	rrrr rrr�Connectabler�r!rrr�r��sd���������D�D�D�D�"2(�2(�2(�2(�2(��)�2(�2(�2(�2(�2(rr�N)r �operatorr�rrrr	r
ryr�sqlrr�objectrr#r�r�r�r!rr�<module>r�s����� �������������������������������������������������
�$�$�$�$�$�V�$�$�$�"g�g�g�g�g�N�g�g�g�T�����/���������&�&�&�&�&� 5�&�&�&������M(�M(�M(�M(�M(��M(�M(�M(�`������r

Hacked By AnonymousFox1.0, Coded By AnonymousFox