Hacked By AnonymousFox

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

�

�܋f�����ddlZddlZddlmZddlmZddlmZddlm	Z	ej
e��ZdZ
Gd�d	e��Zd
�Zd�Zd�Zd
�Zejd���Zejd���Zejd���Zejd���Zejd���Zejd���Zejd���Zd�Zejd���Zejd���ZdS)�N�)�config)�engines�)�url)�compatc�6�eZdZd�Zed���Zd�Zd�ZdS)�registerc��i|_dS�N��fns)�selfs �o/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/sqlalchemy/testing/provision.py�__init__zregister.__init__s
�������c�V�t���d��|��S�N�*)r
�for_db)�cls�fns  r�initz
register.inits$��%�x�z�z� � ��%�%�b�)�)�)rc������fd�}|S)Nc���|�j�<�Srr
)r�dbnamers ��r�decoratez!register.for_db.<locals>.decorates���!�D�H�V���Kr�)rrrs`` rrzregister.for_dbs)����	�	�	�	�	�	��rc�<�t|tj��rtj|��}n)t|tj��r|}n|jj}|���}||j	vr|j	||g|�R�S|j	d|g|�R�Sr)
�
isinstancer�string_types�sa_url�make_url�URL�dbr�get_backend_namer)r�cfg�argr�backends     r�__call__zregister.__call__s����c�6�.�/�/�	��/�#�&�&�C�C�
��V�Z�
(�
(�	��C�C��&�*�C��&�&�(�(���d�h���$�4�8�G�$�S�/�3�/�/�/�/� �4�8�C�=��+�s�+�+�+�+rN)�__name__�
__module__�__qualname__r�classmethodrrr*rrrr
r
s\����������*�*��[�*����,�,�,�,�,rr
c��t��D]>}t�d||jj��t||j|���?dS)NzCREATE database %s, URI %r)�_configs_for_db_operation�log�infor%r�	create_db��follower_identr's  r�create_follower_dbr6+sS��(�*�*�/�/�����-�~�s�v�z�J�J�J��#�s�v�~�.�.�.�.�/�/rc���tj|�����}|���|rt	||��}i}t||��t
j||��}t|||��|�	���
��tj�
||||��}|rt||��|Sr)r"r#�get_dialect�load_provisioning�follower_url_from_main�update_db_optsr�testing_engine�post_configure_engine�connect�closer�Configr
�configure_follower)�db_url�options�file_configr5�dialect�db_opts�engr's        r�setup_configrH1s����o�f�%�%�1�1�3�3�G��������@�'���?�?���G��6�7�#�#�#�
�
 ���
1�
1�C��&�#�~�6�6�6��K�K�M�M������
�-�
 �
 ��g�w��
D�
D�C��0��3��/�/�/��Jrc��t��D]>}t�d||jj��t||j|���?dS)NzDROP database %s, URI %r)r0r1r2r%r�drop_dbr4s  r�drop_follower_dbrKFsS��(�*�*�-�-�����+�^�S�V�Z�H�H�H���S�V�^�,�,�,�,�-�-rc#��K�t��}tj���D]}|j����tj���D]T}|jj}|���}||j|j	|j
f}||vr|V�|�|���Utj���D]}|j����dSr)�setrr@�all_configsr%�disposerr&�username�host�database�add)�hostsr'rr)�	host_confs     rr0r0Ls������E�E�E��}�(�(�*�*�������������}�(�(�*�*�!�!���f�j���&�&�(�(���c�l�C�H�c�l�C�	��E�!�!��I�I�I��I�I�i� � � ���}�(�(�*�*�������������rc�0�td|jz���)z�Dynamically create a database for testing.

    Used when a test run will employ multiple processes, e.g., when run
    via `tox` or `pytest -n4`.
    z"no DB creation routine for cfg: %s��NotImplementedErrorr�r'rG�idents   rr3r3_s���B�S�W�L�
M�
M�Mrc�0�td|jz���)z8Drop a database that we dynamically created for testing.zno DB drop routine for cfg: %srWrYs   rrJrJis���>���H�
I�
I�Irc��dS)zCSet database options (db_opts) for a test database that we created.Nr)rBrFs  rr;r;o�	��	�Drc��dS)z�Perform extra steps after configuring an engine for testing.

    (For the internal dialects, currently only used by sqlite.)
    Nr)r�enginer5s   rr=r=us	��	�Drc�<�tj|��}||_|S)z�Create a connection URL for a dynamically-created test database.

    :param url: the connection URL specified when the test run was invoked
    :param ident: the pytest-xdist "worker identifier" to be used as the
                  database name
    )r"r#rR�rrZs  rr:r:~s���/�#�
�
�C��C�L��Jrc��dS)z@Create dialect-specific config settings for a follower database.Nr)r'rZs  rrArA�r]rc��dS)a[Remove databases that were created during the test process, after the
    process has ended.

    This is an optional step that is invoked for certain backends that do not
    reliably release locks on the database as long as a process is still in
    use. For the internal dialects, this is currently only necessary for
    mssql and oracle.
    Nrras  r�run_reap_dbsrd�s	��	�Drc��t�d��tjt��}tjt��}i}t|��5}|D]�}|���}|�d��\}}tj	|��}||vr1|�
��||<||���|���|j
f}	||	�|��||	�|����	ddd��n#1swxYwY|D]5}	t||	��d}
||	}t!|
|���6dS)NzReaping databases...� r)r1r2�collections�defaultdictrM�open�strip�splitr"r#r8r9r&rQrS�listrd)�idents_file�urls�idents�dialects�file_�line�db_namerB�url_obj�url_keyrrZs            r�reap_dbsrv�s����H�H�
#�$�$�$��"�3�'�'�D�
�
$�S�
)�
)�F��H�	
�k�	�	�
)�e��		)�		)�D��:�:�<�<�D�"�j�j��o�o�O�G�V��o�f�-�-�G��h�&�&�$+�$7�$7�$9�$9���!���!�3�3�5�5�5��/�/�1�1�7�<�@�G���M���f�%�%�%��7�O����(�(�(�(�		)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)��!�!���4��=�!�!�!�$���w����S�%� � � � �!�!s�CD7�7D;�>D;c�0�td|jz���)aOSpecify keyword arguments for creating a temporary Table.

    Dialect-specific implementations of this method will return the
    kwargs that are passed to the Table method when creating a temporary
    table for testing, e.g., in the define_temp_tables method of the
    ComponentReflectionTest class in suite/test_reflection.py
    z.no temp table keyword args routine for cfg: %srW)r'rGs  r�temp_table_keyword_argsrx�s ���8�3�7�B���rc��dSrr)rr%�testclss   r�stop_test_classr{�s���Dr)rg�logging�rrr_rr"�utilr�	getLoggerr+r1�FOLLOWER_IDENT�objectr
r6rHrKr0rr3rJr;r=r:rArdrvrxr{rrr�<module>r�s����������������������"�"�"�"�"�"��������g���!�!����,�,�,�,�,�v�,�,�,�:/�/�/����*-�-�-����&
��N�N���N�
��J�J���J�

��	�	���	�

��	�	���	�
��	�	���	�
��	�	���	�

��		�		���		�!�!�!�2
��
�
���
�
��	�	���	�	�	r

Hacked By AnonymousFox1.0, Coded By AnonymousFox