Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/testing/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/testing/__pycache__/fixtures.cpython-311.pyc

�

�܋f�#��t�UddlmZddlZddlmZddlZddlZddlmZddlm	Z	ddl
mZddl
mZddl
m
Z
dd	l
mZdd
l
mZddl
mZddl
mZdd
lmZddlmZddlmZddlmZddlmZddlZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl'm)Z)ddl'm*Z*ej+��Z,e,�-dg��Gd�de��ZGd�d ee��Ze)rdd!lm.Z.n
Gd"�d#��Z.d$e._/d0d&�Z0iZ1d'e2d(<ed)���Z3ed*���Z4					d1d-�Z5Gd.�d/��Z6dS)2�)�annotationsN)�contextmanager)�Any)�Dict)�Column)�inspect)�MetaData)�String)�Table)�testing)�text)�config)�mock)�eq_)�
TablesTest)�TestBase�)�_get_dialect�)�EnvironmentContext)�MigrationContext)�
Operations)�sqla_compat��create_mock_engine)�sqla_14)�sqla_2ztest.cfgc��eZdZeZej��d���Zejd���Zejd���Z	dS)rc#�K�|�d���5t|��V�ddd��dS#1swxYwYdS)NT)�_per_migration)�begin_transactionr)�self�migration_contexts  �i/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/alembic/testing/fixtures.py�ops_contextzTestBase.ops_context)s�����
�
0�
0��
0�
E�
E�	0�	0��.�/�/�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0s�8�<�<c�J�tj|td������S)NT)�transaction_per_migration)�opts)r�	configure�dict)r"�
connections  r$r#zTestBase.migration_context.s,���)��T�D�A�A�A�
�
�
�	
�c#�K�tj���5}|V�ddd��dS#1swxYwYdS�N)r�db�connect)r"�conns  r$r+zTestBase.connection4s�����
�Y�
�
�
 �
 �	�D��J�J�J�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�3�7�7N)
�__name__�
__module__�__qualname__r�is_sqlalchemy_futurer�fixturer%r#r+�r,r$rr&sx������!���W�_���0�0���0�
�_�
�
��_�
�

�_����_���r,rc��eZdZdS)rN)r2r3r4r7r,r$rr:s�������Dr,r)�FutureEngineMixinc��eZdZdZdS)r9)�
sqlalchemy_14N)r2r3r4�__requires__r7r,r$r9r9Bs������)���r,r9T�
postgresql://c�>���g���fd�}t||�����fS)Nc�~����t|��j�������dS�N)�dialect)�append�str�compilerA)�sql�multiparams�params�buf�engines   ��r$�dumpzcapture_db.<locals>.dumpLs3����
�
�3�s�{�{�6�>�{�:�:�;�;�<�<�<�<�<r,r)rArJrHrIs  @@r$�
capture_dbrKIsB����
�C�=�=�=�=�=�=� ���
.�
.�F��3�;�r,zDict[Any, Any]�_engsc+�b��K���dd��rtj��}ntj��}��d|d���t
j���fd�}tj�	t
d|��5|V�ddd��dS#1swxYwYdS)N�bytes_ioF�sqlite)�dialect_name�
output_bufferc�.��|jdi����|i|��S�Nr7��update��arg�opt�conf�kws  ��r$r)z)capture_context_buffer.<locals>.configure`�0�����
���R�����t�S� �C� � � r,r))
�pop�io�BytesIO�StringIOrUrr)r�patch�object)rZrHr)rYs`  @r$�capture_context_bufferrbVs������	�v�v�j�%� � ���j�l�l����k�m�m���I�I�x�#�>�>�?�?�?��'�D�!�!�!�!�!�!�
��	�	�-�{�I�	F�	F����	�	�	���������������������s�B$�$B(�+B(c+����K�ddlm}ddlm}t	j���|��}|���}|�|d���fd���}��d|i��tj
���fd�}tj�
td	|��5�V�ddd��dS#1swxYwYdS)
Nr)�_sqlite_file_dbr)�event�before_cursor_executec�8����|dz��dS)N�
)�write)r1�cursor�	statement�
parameters�context�executemanyrHs      �r$�bcez*capture_engine_context_buffer.<locals>.bcess ����	�	�)�d�"�#�#�#�#�#r,r+c�.��|jdi����|i|��SrSrTrVs  ��r$r)z0capture_engine_context_buffer.<locals>.configurezr[r,r))�envrd�
sqlalchemyrer]r_r0�listens_forrUrr)rr`ra)	rZrdre�engr1ror)rHrYs	`      @@r$�capture_engine_context_bufferruhsP�������$�$�$�$�$�$� � � � � � �
�+�-�-�C�
�/�
�
�C��;�;�=�=�D�
���t�4�5�5�$�$�$�$�6�5�$��I�I�|�T�"�#�#�#��'�D�!�!�!�!�!�!�
��	�	�-�{�I�	F�	F����	�	�	���������������������s�3C�C	�C	�defaultFc������i}|rt|���|d<G�fd�d��}|���G�fd�dt��}�r�|d<|r||d<ts|d	krtd
���d�_nt|���|�|�_d�_�s��fd
�}tj�|���}	n�|d<d}	|�|	|��}
t|
��tj_|
S)N)�naming_convention�target_metadatac�&��eZdZd�Z�fd�Zd�ZdS)�op_fixture.<locals>.buffer_c��g|_dSr.��lines�r"s r$�__init__z$op_fixture.<locals>.buffer_.__init__�s
���D�J�J�Jr,c����|���}tjdd|��}�r,tjdd|��}tjdd|��}|j�|��dS)N�[\n\t]�z    z\;\n*$)�strip�re�subr~rB)r"�msg�as_sqls  �r$riz!op_fixture.<locals>.buffer_.write�so����)�)�+�+�C��&��B��,�,�C��
1��f�W�b�#�.�.���f�Y��C�0�0���J���c�"�"�"�"�"r,c��dSr.r7rs r$�flushz!op_fixture.<locals>.buffer_.flush�s���Dr,N)r2r3r4r�rir�)r�s�r$�buffer_r{�sL�������	�	�	�		#�		#�		#�		#�		#�	�	�	�	�	r,r�c�8��eZdZ�fd�Z�fd�Z�fd�Z�fd�ZdS)�op_fixture.<locals>.ctxc����Sr.r7�r"rHs �r$�get_bufzop_fixture.<locals>.ctx.get_buf�s����Jr,c� ��g�jdd�<dSr.r}r�s �r$�clear_assertionsz(op_fixture.<locals>.ctx.clear_assertions�s����C�I�a�a�a�L�L�Lr,c�F��t�jd�|D����dS)Nc�:�g|]}tjdd|����S)r�r�)r�r�)�.0�ss  r$�
<listcomp>z3op_fixture.<locals>.ctx.assert_.<locals>.<listcomp>�s&��B�B�B��B�F�9�b�!�4�4�B�B�Br,)rr~)r"rErHs  �r$�assert_zop_fixture.<locals>.ctx.assert_�s,���
��	�B�B�c�B�B�B�C�C�C�C�Cr,c�x���jD]}tjdd|��|vrdS�Jd|�d�j�����)Nr�r�FzCould not locate fragment z in )r~r�r�)r"rE�stmtrHs   �r$�assert_containsz'op_fixture.<locals>.ctx.assert_contains�sb����	�
�
���6�)�R��-�-��5�5��F�F�6����C�C��I�I����ur,N)r2r3r4r�r�r�r�)rHs�r$�ctxr��s~�������	�	�	�	�	�	�	�	�	�	�	D�	D�	D�	D�	D�
	�	�	�	�	�	�	r,r�r��
literal_binds�mariadb�mysql)�
�r�MariaDBTc����t|t��rt|��}|jsJ�t|�������}��|��dSr@)�
isinstancerCr
�supports_executionrDri)r��
multiparam�paramrErH�ctx_dialects    ��r$�executezop_fixture.<locals>.execute�s]����$��$�$�
"��D�z�z���*�*�*�*��d�l�l�;�l�7�7�8�8�C��I�I�c�N�N�N�N�Nr,)rAr�rQ)
r	rrr�server_version_info�supports_native_boolean�#non_native_boolean_check_constraintr�Mockr�alembic�op�_proxy)
rAr�rxr��native_booleanr(r�r�r�r+rmrHr�s
 `         @@r$�
op_fixturer��s�������D��P�"*�=N�"O�"O�"O��
������������$�'�)�)�C������������,� ���X���.� -��_���,�w�)�+�+�"�7�+�+��*?��'�'�#�7�+�+���!�.<��+�;?��7��
�	�	�	�	�	�	��Y�{�G�D�D�D�
�
� #��_���
��c�+�z�4�0�0�G�"�7�+�+�G�J���Nr,c�2�eZdZdZd�Zd�Zd�Zd�Zdd�ZdS)	�AlterColRoundTripFixture)�alter_columnc���tj���|_t	j|j��|_t|j��|_t��|_
dSr.)rr/r0r1rr)r�rr�r	�metadatars r$�setUpzAlterColRoundTripFixture.setUp�sK���I�%�%�'�'��	�#�-�d�i�8�8����T�X�&�&��� �
�
��
�
�
r,c��td|��}td|��}|jj�||��rJd|�d|�d����dS)N�qz
Type objects � and � didn't compare as equivalent)rr��impl�compare_type)r"�t1�t2�c1�c2s     r$�
_compare_typez&AlterColRoundTripFixture._compare_type�sw��
�C��_�_��
�C��_�_���8�=�-�-���
�
�	L�	L�	L�DF�B�B����K�	L�	L�
�	L�	Lr,c��td||���}td||���}|jj�||||��rJd|�d|�d����dS)Nr�)�server_defaultzserver defaults r�r�)rr�r��compare_server_default)r"r��s1r��s2r�r�s       r$�_compare_server_defaultz0AlterColRoundTripFixture._compare_server_default�s���
�C��B�
/�
/�
/��
�C��B�
/�
/�
/���8�=�7�7���B��
�
�	O�	O�	O�GI�r�r�2�2�2�N�	O�	O�
�	O�	Or,c�
�tj|j��|j���5|j�|j��ddd��n#1swxYwY|j���dSr.)r�%_safe_rollback_connection_transactionr1�beginr��drop_all�closers r$�tearDownz!AlterColRoundTripFixture.tearDown�s����9�$�)�D�D�D�
�Y�_�_�
�
�	.�	.��M�"�"�4�9�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.��	�������s� A�A#�&A#Nc��t|�dd��|�dtd����|�dd��|�dd�����}td	|j|��}tj|j��5|�|j��t|j��}|�
d	��d
}|j�d	|j
|j|j�|jnd|jrdnd|�dd��|�dd��|�dd��|�dd����	�	ddd��n#1swxYwYt|j��}|�
d	��d
}|�|}t#|dd|vr|dn|j
��|�|d|�d|d����t#|d|�d|j����|�|d|�d
d��|�d|d��d|vr
|djn|j�|jjjnd��dS)N�name�colname�typer��nullableTr�)r�r��xrF)�
existing_type�existing_server_default�existing_nullabler�r��new_column_name�type_rv)r�getr
rr�r�_ensure_scope_for_ddlr1�creater�get_columnsr�r�r�r�r�r�rr�r�r
rW)	r"�from_�to_�compare�column�t�insp�old_col�new_cols	         r$�_run_alter_colz'AlterColRoundTripFixture._run_alter_col�s�����I�I�f�i�(�(��I�I�f�f�R�j�j�)�)��Y�Y�z�4�0�0� �9�9�%5�t�<�<�	
�
�
��
�#�t�}�f�-�-��
�
.�t�y�
9�
9�	�	�
�H�H�T�Y�����4�9�%�%�D��&�&�s�+�+�A�.�G�
�G� � ����$�k��(�4�)/�(=�(=��*0�/�"D�$�$�u�����T�2�2�"�w�w�'7��?�?� #����� 5� 5��g�g�f�d�+�+�
!�
�
�
�
	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�,�t�y�!�!���"�"�3�'�'��*���?��G���F�O�%��0�0�G�F�O�O�f�k�	
�	
�	
�	
����F�O�W�[�[�����A�A�	
�	
�	
�	�G�J�����Z���!I�!I�J�J�J��$�$��F�O��K�K�	�4�(�(��K�K�����0�0��7�*�*�
�$�%�*�*��$�0��&�*�/�/��		
�		
�		
�		
�		
s� CF
�
F�Fr.)	r2r3r4r<r�r�r�r�r�r7r,r$r�r��sq������%�L�#�#�#�L�L�L�O�O�O����7
�7
�7
�7
�7
�7
r,r�)r=)rvFNFN)7�
__future__r�configparser�
contextlibrr]r��typingrrrrrrr	r
rrr
�sqlalchemy.testingrr�sqlalchemy.testing.assertionsr�sqlalchemy.testing.fixturesr�SQLAlchemyTablesTestr�SQLAlchemyTestBaser��
assertionsr�environmentr�	migrationr�
operationsr�utilr�util.sqla_compatrrr�ConfigParser�testing_config�readr9r5rKrL�__annotations__rbrur�r�r7r,r$�<module>r�st��"�"�"�"�"�"�"�����%�%�%�%�%�%�	�	�	�	�	�	�	�	�������������������������������������������������������%�%�%�%�%�%�#�#�#�#�#�#�-�-�-�-�-�-�J�J�J�J�J�J�F�F�F�F�F�F�����$�$�$�$�$�$�,�,�,�,�,�,�(�(�(�(�(�(�#�#�#�#�#�#�������1�1�1�1�1�1�&�&�&�&�&�&�%�%�%�%�%�%�+��*�,�,�����Z�L�!�!�!������!����(	�	�	�	�	��/�	�	�	��*�=�=�=�=�=�=�=�*�*�*�*�*�*�*�*�*.��&�����������������"������4
�����V�V�V�V�rY
�Y
�Y
�Y
�Y
�Y
�Y
�Y
�Y
�Y
r,

Hacked By AnonymousFox1.0, Coded By AnonymousFox