403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/django/db/backends/base/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/db/backends/base/__pycache__/creation.cpython-311.pyc
�

�|�e39���ddlZddlZddlmZddlmZmZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZd
ZGd�d��ZdS)
�N)�StringIO)�expectedFailure�skip)�apps)�settings)�serializers)�router)�atomic)�
import_string�test_c��eZdZdZd�Zd�Zd�Zdd�Zd	�Zd
�Z	d�Z
d�Zd
�Zdd�Z
dd�Zdd�Zd�Zdd�Zdd�Zd�Zd�Zd�Zd�ZdS)�BaseDatabaseCreationzs
    Encapsulate backend-specific differences pertaining to creation and
    destruction of the test database.
    c��||_dS�N)�
connection)�selfrs  �B/usr/lib/python3/dist-packages/django/db/backends/base/creation.py�__init__zBaseDatabaseCreation.__init__s
��$�����c�4�|j���Sr)r�_nodb_cursor�rs rrz!BaseDatabaseCreation._nodb_cursors����+�+�-�-�-rc�^�tj�|tjz��dSr)�sys�stderr�write�os�linesep)r�msgs  r�logzBaseDatabaseCreation.logs%���
����r�z�)�*�*�*�*�*r�FTc��ddlm}|���}|dkr5d}|rd}|�|�d|�||���d���|�|||��|j���|tj	|jj
d<||jjd<	|jjd	d
dur3tj}d�tj��D��t_|d
t|dz
d��d|jj
d���|jjd	d
dur|t_n+#|jjd	d
dur|t_wxYw|r|���|j_|d|jj
���|j���t&j�d��dkr|���|S)z�
        Create a test database, prompting the user for confirmation if the
        database already exists. Return the name of the test database created.
        r)�call_commandr!�CreatingzUsing existing� test database for alias �...�NAME�TEST�MIGRATEFc��i|]
}|jd��Sr)�label)�.0�apps  r�
<dictcomp>z7BaseDatabaseCreation.create_test_db.<locals>.<dictcomp>Cs,��.�.�.���I�t�.�.�.r�migrateT)�	verbosity�interactive�database�
run_syncdb�createcachetable)r2�RUNNING_DJANGOS_TEST_SUITE�true)�django.core.managementr#�_get_test_db_namer �_get_database_display_str�_create_test_dbr�closer�	DATABASES�alias�
settings_dict�MIGRATION_MODULESr�get_app_configs�max�serialize_db_to_string�_test_serialized_contents�ensure_connectionr�environ�get� mark_expected_failures_and_skips)	rr0�autoclobber�	serialize�keepdbr#�test_database_name�action�old_migration_moduless	         r�create_test_dbz#BaseDatabaseCreation.create_test_db s=��	8�7�7�7�7�7�!�3�3�5�5����>�>��F��
*�)���H�H�����.�.�y�:L�M�M�M�M��
�
�
�	
���Y��V�<�<�<��������<N���4�?�0�1�&�9�0B���%�f�-�	C���,�V�4�Y�?�5�H�H�(0�(B�%�.�.�#�3�5�5�.�.�.��*�
�L���i�!�m�Q�/�/�!���.��
�
�
�
���,�V�4�Y�?�5�H�H�-B��*�����,�V�4�Y�?�5�H�H�-B��*�B�B�B�B��	V�8<�8S�8S�8U�8U�D�O�5���'�$�/�2G�H�H�H�H�	
��)�)�+�+�+�
�:�>�>�6�7�7�6�A�A��1�1�3�3�3�!�!s
�5A8E�(E<c�0�|d|jjd<dS)z�
        Set this database up to be used in testing as a mirror of a primary
        database whose settings are given.
        r'N)rr>)r�primary_settings_dicts  r�set_as_test_mirrorz'BaseDatabaseCreation.set_as_test_mirrorfs��
1F�f�0M���%�f�-�-�-rc����fd�}t��}tjd|��d|���|���S)z�
        Serialize all data in the database into a JSON string.
        Designed only for test runner usage; will not handle large
        amounts of data.
        c3��K�ddlm}|�j��}tj��D]�}|j��|j|jvr�|jtj
vr�|���D]�}|j�
�j��rtj�jj|��r`|j��jj���|jjj��}|���Ed{V������dS)Nr)�MigrationLoader)�django.db.migrations.loaderrTrrr@�
models_moduler+�
migrated_apps�namer�TEST_NON_SERIALIZED_APPS�
get_models�_meta�can_migrater	�allow_migrate_modelr=�
_base_manager�using�order_by�pk�iterator)rT�loader�
app_config�model�querysetrs     �r�get_objectsz@BaseDatabaseCreation.serialize_db_to_string.<locals>.get_objectsts&�����C�C�C�C�C�C�$�_�T�_�5�5�F�"�2�4�4�
;�
;�
��,�8��$��(<�<�<��O�8�+L�L�L�!+�!6�!6�!8�!8�;�;��!�K�3�3�D�O�D�D�;�"�6�t��7L�e�T�T�;�(-�':�'@�'@� $�� 5�(�(�&�h�u�{�~�':�;�;�%�(0�'8�'8�':�':�:�:�:�:�:�:�:���
;�
;r�jsonN)�indent�stream)rrrI�getvalue)rrg�outs`  rrBz+BaseDatabaseCreation.serialize_db_to_stringmsU���	;�	;�	;�	;�	;�&�j�j����f�k�k�m�m�D��M�M�M�M��|�|�~�~�rc��t|��}t��}t|jj���5|j���5t
jd||jj���D]?}|���|�	|j
jjj
���@	ddd��n#1swxYwY|j�|���ddd��dS#1swxYwYdS)zw
        Reload the database with data from a string generated by
        the serialize_db_to_string() method.
        )r_rhN)�table_names)r�setr
rr=�constraint_checks_disabledr�deserialize�save�add�object�	__class__r[�db_table�check_constraints)r�datarn�objs    r�deserialize_db_from_stringz/BaseDatabaseCreation.deserialize_db_from_string�s���
��~�~���e�e��
�$�/�/�
0�
0�
0�		G�		G���;�;�=�=�
I�
I�&�2�6�4�t��G\�]�]�]�I�I�C��H�H�J�J�J��O�O�C�J�$8�$>�$G�H�H�H�H�I�
I�
I�
I�
I�
I�
I�
I�
I�
I�
I�
I����
I�
I�
I�
I�
�O�-�-�+�-�F�F�F�		G�		G�		G�		G�		G�		G�		G�		G�		G�		G�		G�		G����		G�		G�		G�		G�		G�		Gs6�C4�A"C�5C4�C	�C4�C	�	C4�4C8�;C8c�<�d|jj�d|dkrd|znd��S)zR
        Return display string for a database for use in various actions.
        �'�z ('%s')�)rr=)rr0�
database_names   rr9z.BaseDatabaseCreation._get_database_display_str�s6���

�O�!�!�!�+4��>�>�Y��
&�
&�r�A�
�	
rc��|jjddr|jjddSt|jjdzS)z�
        Internal implementation - return the name of the test DB that will be
        created. Only useful when called from create_test_db() and
        _create_test_db() and when no external munging is done with the 'NAME'
        settings.
        r(r')rr>�TEST_DATABASE_PREFIXrs rr8z&BaseDatabaseCreation._get_test_db_name�sF���?�(��0��8�	A��?�0��8��@�@�#�d�o�&C�F�&K�K�Krc�6�|�d|z��dS)Nz%CREATE DATABASE %(dbname)s %(suffix)s)�execute)r�cursor�
parametersrJs    r�_execute_create_test_dbz,BaseDatabaseCreation._execute_create_test_db�s �����>��K�L�L�L�L�Lrc	��|���}|jj�|��|���d�}|���5}	|�|||���n1#t$�r#}|r|cYd}~cddd��S|�d|z��|std|z��}|s|dkr�	|dkr-|�d|�
||���d���|�d	|z��|�|||��nl#t$r6}|�d
|z��tj
d��Yd}~n1d}~wwxYw|�d��tj
d��Yd}~nd}~wwxYwddd��n#1swxYwY|S)
zF
        Internal implementation - create the test db tables.
        )�dbname�suffixNz+Got an error creating the test database: %szXType 'yes' if you would like to try deleting the test database '%s', or 'no' to cancel: �yesr!z'Destroying old test database for alias r&zDROP DATABASE %(dbname)sz-Got an error recreating the test database: %sr}zTests cancelled.)r8r�ops�
quote_name�sql_table_creation_suffixrr��	Exceptionr �inputr9r�r�exit)	rr0rHrJrK�test_db_paramsr��e�confirms	         rr:z$BaseDatabaseCreation._create_test_db�s��"�3�3�5�5���o�)�4�4�5G�H�H��4�4�6�6�
�
��
�
�
�
 �
 �	 �F�
 ��,�,�V�^�V�L�L�L�L���
 �
 �
 ��.�-�-�-�-�-�-�	 �	 �	 �	 �	 �	 �	 �	 ����F��J�K�K�K�"�S�#�=�?Q�R�S�S�G��
 �'�U�"2�"2�	$�$��>�>� �H�H�H� $� >� >�y�J\� ]� ]� ]� ]�&�������'A�N�'R�S�S�S��4�4�V�^�V�T�T�T�T��$�$�$�$����!P�ST�!T�U�U�U����������������$�����H�H�/�0�0�0��H�Q�K�K�K����������1
 ����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �:"�!sy�F5�A8�6F5�8F&�F!�F&�F5�4F!�
A"D0�/F!�0
E0�:,E+�&F!�+E0�0,F!�F5�!F&�&F5�5F9�<F9c���|jjd}|dkr5d}|rd}|�|�d|�||���d���|�|||��dS)z(
        Clone a test database.
        r'r!zCloning test databasezUsing existing clonez for alias r&N)rr>r r9�_clone_test_db)rr�r0rHrJ�source_database_namerLs       r�
clone_test_dbz"BaseDatabaseCreation.clone_test_db�s��� $��<�V�D����>�>�,�F��
0�/���H�H�����.�.�y�:N�O�O�O�O��
�
�
�	
���F�I�v�6�6�6�6�6rc�^�|jj}i|�dd�|d|��i�S)zX
        Return a modified connection settings dict for the n-th clone of a DB.
        r'z{}_{})rr>�format)rr��orig_settings_dicts   r�get_test_db_clone_settingsz/BaseDatabaseCreation.get_test_db_clone_settings�s;��"�_�:��a�$�a�f�g�n�n�=O�PV�=W�Y_�.`�.`�a�a�arc� �td���)zI
        Internal implementation - duplicate the test db tables.
        znThe database backend doesn't support cloning databases. Disable the option to run tests in parallel processes.)�NotImplementedError)rr�r0rJs    rr�z#BaseDatabaseCreation._clone_test_db�s��"�
E�F�F�	FrNc��|j���|�|jjd}n|�|��d}|dkr5d}|rd}|�|�d|�||���d���|s|�||��|�0|tj|jj	d<||jjd<dSdS)zv
        Destroy a test database, prompting the user for confirmation if the
        database already exists.
        Nr'r!�
Destroying�
Preservingr%r&)
rr;r>r�r r9�_destroy_test_dbrr<r=)r�old_database_namer0rJr�rKrLs       r�destroy_test_dbz$BaseDatabaseCreation.destroy_test_dbs���
	
��������>�!%��!>�v�!F���!%�!@�!@��!H�!H��!P����>�>�!�F��
&�%���H�H�����.�.�y�:L�M�M�M�M��
�
�
��	A��!�!�"4�i�@�@�@��(�@Q�H��t��4�5�f�=�4E�D�O�)�&�1�1�1�)�(rc���|���5}|�d|jj�|��z��ddd��dS#1swxYwYdS)zF
        Internal implementation - remove the test db tables.
        zDROP DATABASE %sN)rr�rr�r�)rrKr0r�s    rr�z%BaseDatabaseCreation._destroy_test_db!s����
�
�
 �
 �	Q�F��N�N�-�!�_�0�;�;�<N�O�O�P�
Q�
Q�
Q�	Q�	Q�	Q�	Q�	Q�	Q�	Q�	Q�	Q�	Q�	Q�	Q����	Q�	Q�	Q�	Q�	Q�	Qs�6A�A�Ac
��|jjjD]�}|�d��\}}}|�d��d}|t
jvr=t|��}t||��}t||t|������|jjj���D]�\}}	|	D]�}|�d��\}}}|�d��d}|t
jvrFt|��}t||��}t||t|��|��������dS)z�
        Mark tests in Django's test suite which are expected failures on this
        database and test which should be skipped on this database.
        �.rN)r�features�django_test_expected_failures�
rpartition�splitr�INSTALLED_APPSr�getattr�setattrr�django_test_skips�itemsr)
r�	test_name�test_case_name�_�test_method_name�test_app�	test_case�test_method�reason�testss
          rrGz5BaseDatabaseCreation.mark_expected_failures_and_skips-sa��
��1�O�	S�	S�I�2;�2F�2F�s�2K�2K�/�N�A�/� ���s�+�+�A�.�H��8�2�2�2�)�.�9�9�	�%�i�1A�B�B���	�#3�_�[�5Q�5Q�R�R�R��!�_�5�G�M�M�O�O�	T�	T�M�F�E�"�
T�
T�	�6?�6J�6J�3�6O�6O�3���#3�$�?�?�3�/�/��2���x�6�6�6� -�n� =� =�I�")�)�5E�"F�"F�K��I�'7���f���k�9R�9R�S�S�S��
T�	T�	Trc��dS)zQ
        SQL to append to the end of the test table creation statements.
        r~�rs rr�z.BaseDatabaseCreation.sql_table_creation_suffixDs	���rrc�n�|jj}|d|d|d|���fS)z�
        Return a tuple with elements of self.connection.settings_dict (a
        DATABASES setting value) that uniquely identify a database
        accordingly to the RDBMS particularities.
        �HOST�PORT�ENGINE)rr>r8)rr>s  r�test_db_signaturez&BaseDatabaseCreation.test_db_signatureJs?����5�
��&�!��&�!��(�#��"�"�$�$�	
�	
r)r!FTF)F)r!FF)Nr!FN)�__name__�
__module__�__qualname__�__doc__rrr rNrQrBrzr9r8r�r:r�r�r�r�r�rGr�r�r�rrrrs}��������%�%�%�.�.�.�+�+�+�D"�D"�D"�D"�LN�N�N����<G�G�G�&
�
�
�	L�	L�	L�M�M�M�M�'"�'"�'"�'"�R7�7�7�7�&b�b�b�F�F�F�F�F�F�F�F�<
Q�
Q�
Q�T�T�T�.���
�
�
�
�
rr)rr�ior�unittestrr�django.appsr�django.confr�django.corer�	django.dbr	�django.db.transactionr
�django.utils.module_loadingrr�rr�rr�<module>r�s���	�	�	�	�
�
�
�
�������*�*�*�*�*�*�*�*������� � � � � � �#�#�#�#�#�#�������(�(�(�(�(�(�5�5�5�5�5�5���D
�D
�D
�D
�D
�D
�D
�D
�D
�D
r

Youez - 2016 - github.com/yon3zu
LinuXploit