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/migrations/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/db/migrations/__pycache__/graph.cpython-311.pyc
�

�|�e)2���ddlmZddlmZddlmZmZeGd�d����ZGd�de��ZGd	�d
��Z	dS)�)�total_ordering)�ProjectState�)�CircularDependencyError�NodeNotFoundErrorc�H�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�Nodezp
    A single node in the migration graph. Contains direct links to adjacent
    nodes in either direction.
    c�`�||_t��|_t��|_dS�N)�key�set�children�parents)�selfrs  �</usr/lib/python3/dist-packages/django/db/migrations/graph.py�__init__z
Node.__init__s#���������
��u�u�����c��|j|kSr�r�r�others  r�__eq__zNode.__eq__s���x�5� � rc��|j|kSrrrs  r�__lt__zNode.__lt__s���x�%��rc�*�t|j��Sr)�hashr�rs r�__hash__z
Node.__hash__s���D�H�~�~�rc��|j|Srr)r�items  r�__getitem__zNode.__getitem__s���x��~�rc�*�t|j��Sr)�strrrs r�__str__zNode.__str__s���4�8�}�}�rc�Z�d|jj�d|jd�d|jd�d�S)N�<z: (r�, rz)>)�	__class__�__name__rrs r�__repr__z
Node.__repr__"s1���#'�>�#:�#:�#:�D�H�Q�K�K�K���RS����U�Urc�:�|j�|��dSr)r�add)r�childs  r�	add_childzNode.add_child%s���
���%� � � � � rc�:�|j�|��dSr)rr,)r�parents  r�
add_parentzNode.add_parent(s������� � � � � rN)
r)�
__module__�__qualname__�__doc__rrrrr!r$r*r.r1�rrr	r	s������������
!�!�!� � � ����������V�V�V�!�!�!�!�!�!�!�!rr	c�(��eZdZdZ�fd�Zd�Z�xZS)�	DummyNodea
    A node that doesn't correspond to a migration file on disk.
    (A squashed migration that was removed, for example.)

    After the migration graph is processed, all dummy nodes should be removed.
    If there are any left, a nonexistent dependency error is raised.
    c�f��t���|��||_||_dSr)�superr�origin�
error_message)rrr:r;r(s    �rrzDummyNode.__init__4s0���
������������*����rc�D�t|j|j|j����)N)r:)rr;rr:rs r�raise_errorzDummyNode.raise_error9s���� 2�D�H�T�[�Q�Q�Q�Qr)r)r2r3r4rr=�
__classcell__)r(s@rr7r7,sX���������+�+�+�+�+�
R�R�R�R�R�R�Rrr7c��eZdZdZd�Zd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zd�Zdd
�Z
dd�Zdd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�ZdS)�MigrationGraphaH
    Represent the digraph of all migrations in a project.

    Each migration is a node, and each dependency is an edge. There are
    no implicit dependencies between numbered migrations - the numbering is
    merely a convention to aid file listing. Every new numbered migration
    has a declared dependency to the previous number, meaning that VCS
    branch merges can be detected and resolved.

    Migrations files can be marked as replacing another set of migrations -
    this is to support the "squash" feature. The graph handler isn't responsible
    for these; instead, the code to load them in here should examine the
    migration files and if the replaced migrations are all either unapplied
    or not present, it should ignore the replaced ones, load in just the
    replacing migration, and repoint any dependencies that pointed to the
    replaced migrations to point to the replacing one.

    A node should be a tuple: (app_path, migration_name). The tree special-cases
    things within an app - namely, root nodes and leaf nodes ignore dependencies
    to other apps.
    c�"�i|_i|_dSr)�node_map�nodesrs rrzMigrationGraph.__init__Ts����
���
�
�
rc�b�||jvsJ�t|��}||j|<||j|<dSr)rBr	rC)rr�	migration�nodes    r�add_nodezMigrationGraph.add_nodeXs;���$�-�'�'�'�'��C�y�y��!��
�c��#��
�3���rc�P�t|||��}||j|<d|j|<dSr)r7rBrC)rrr:r;rFs     r�add_dummy_nodezMigrationGraph.add_dummy_node^s.����f�m�4�4��!��
�c����
�3���rFc��||jvrd|�d|��}|�|||��||jvrd|�d|��}|�|||��|j|�|j|��|j|�|j|��|s|���dSdS)z�
        This may create dummy nodes if they don't yet exist. If
        `skip_validation=True`, validate_consistency() should be called
        afterwards.
        z
Migration z/ dependencies reference nonexistent child node z0 dependencies reference nonexistent parent node N)rCrIrBr1r.�validate_consistency)rrEr-r0�skip_validationr;s      r�add_dependencyzMigrationGraph.add_dependencycs�����
�"�"�"�%.�I�I�u�u�6�
�
����y�-�@�@�@����#�#�#�&/�Y�Y���8�
�
����	�=�A�A�A��
�e��'�'��
�f�(=�>�>�>��
�f��'�'��
�e�(<�=�=�=��	(��%�%�'�'�'�'�'�	(�	(rc�f�t|��}	|j|}n'#t$r}td|�d�|��|�d}~wwxYw|D]�}|j�|d��|j�|d��}|r�|jD]O}|j�|��|j	|vr*|�
|��|�|���P|jD]O}|j�|��|j	|vr*|�|��|�
|���P��dS)z�
        Remove each of the `replaced` nodes (when they exist). Any
        dependencies that were referencing them are changed to reference the
        `replacement` node instead.
        z Unable to find replacement node zH. It was either never added to the migration graph, or has been removed.N)r
rB�KeyErrorrrC�poprr�removerr.r1)	r�replacement�replaced�replacement_node�err�replaced_key�
replaced_noder-r0s	         r�remove_replaced_nodesz$MigrationGraph.remove_replaced_nodeszs~���x�=�=��	�#�}�[�9�����	�	�	�#�#�CN�;�;�Q�����	
�����	����%�	;�	;�L��J�N�N�<��.�.�.� �M�-�-�l�D�A�A�M��
;�*�3�;�;�E��M�(�(��7�7�7��y��0�0�(�2�2�5�9�9�9��(�(�)9�:�:�:��+�3�;�;�F��O�*�*�=�9�9�9��z��1�1�(�3�3�F�;�;�;��(�(�)9�:�:�:���#	;�	;s�
�
A�>�Ac�r�|j�|d��	|j�|��}n'#t$r}t	d|�d�|��|�d}~wwxYwt��}t��}|D]=}|j�|��}|r|�|��||jz}�>||z}|j	D]K}	|	j�
|��|D],}|�|	��|	�|���-�L|jD]}
|
j	�
|���dS)a*
        The inverse operation to `remove_replaced_nodes`. Almost. Remove the
        replacement node `replacement` and remap its child nodes to `replaced`
        - the list of nodes it would have replaced. Don't remap its parent
        nodes as they are expected to be correct already.
        Nz"Unable to remove replacement node zP. It was either never added to the migration graph, or has been removed already.)
rCrPrBrOrr
�getr,rrrQr.r1)rrRrSrTrU�replaced_nodes�replaced_nodes_parentsrrWr-r0s           r�remove_replacement_nodez&MigrationGraph.remove_replacement_node�s���	
�
���{�D�)�)�)�	�#�}�0�0��=�=�����	�	�	�#�#�KV�;�;�Y�����	
�����	��������!$�����	@�	@�C� �M�-�-�c�2�2�M��
@��"�"�=�1�1�1�&�-�*?�?�&��	�0�0��%�.�	0�	0�E��M� � �!1�2�2�2�!/�
0�
0�
��'�'��.�.�.�� � ��/�/�/�/�
0�'�.�	5�	5�F��O�"�"�#3�4�4�4�4�	5�	5s�8�
A�A�Ac�L�d�|j���D��dS)z7Ensure there are no dummy nodes remaining in the graph.c�`�g|]+}t|t���|�����,Sr5)�
isinstancer7r=��.0�ns  r�
<listcomp>z7MigrationGraph.validate_consistency.<locals>.<listcomp>�s/��U�U�U�Q�J�q�)�<T�<T�U������U�U�UrN)rB�valuesrs rrKz#MigrationGraph.validate_consistency�s*��U�U�$�-�"6�"6�"8�"8�U�U�U�U�U�Urc�|�||jvrtd|�d�|���|�|j|��S)z�
        Given a node, return a list of which previous nodes (dependencies) must
        be applied, ending with the node itself. This is the list you would
        follow if applying the migrations to a database.
        �Node � not a valid node�rCr�
iterative_dfsrB�r�targets  r�
forwards_planzMigrationGraph.forwards_plan�sF�����#�#�#�#�&�&�&�$J�F�S�S�S��!�!�$�-��"7�8�8�8rc��||jvrtd|�d�|���|�|j|d���S)z�
        Given a node, return a list of which dependent nodes (dependencies)
        must be unapplied, ending with the node itself. This is the list you
        would follow if removing the migrations from a database.
        rgrhF)�forwardsrirks  r�backwards_planzMigrationGraph.backwards_plan�sK�����#�#�#�#�&�&�&�$J�F�S�S�S��!�!�$�-��"7�%�!�H�H�HrTc�V�g}t��}|dfg}|r�|���\}}||vrns|r0|�|��|�|j��nA|�|df��|d�t|r|jn|j��D��z
}|��|S)z6Iterative depth-first search for finding dependencies.FTc��g|]}|df��S�Fr5ras  rrdz0MigrationGraph.iterative_dfs.<locals>.<listcomp>�s��b�b�b��1�e�*�b�b�br)r
rPr,�appendr�sortedrr)r�startro�visited�visited_set�stackrF�	processeds        rrjzMigrationGraph.iterative_dfs�s������e�e����� ���		c�#�i�i�k�k�O�D�)��{�"�"���
c�����%�%�%����t�x�(�(�(�(����d�D�\�*�*�*��b�b�f�X�5`�T�\�\�SW�S`�.a�.a�b�b�b�b���		c��rNc����t��}|jD]P�t�fd�|j�jD����r#|r|�dkr|�����Qt
|��S)z�
        Return all root nodes - that is, nodes with no dependencies inside
        their app. These are the starting point for an app.
        c3�<�K�|]}|d�dkV��dS�rNr5�rbrrFs  �r�	<genexpr>z,MigrationGraph.root_nodes.<locals>.<genexpr>�s0�����L�L��3�q�6�T�!�W�$�L�L�L�L�L�Lrr)r
rC�allrBrr,ru)r�app�rootsrFs   @r�
root_nodeszMigrationGraph.root_nodes�s����
�����J�	 �	 �D��L�L�L�L��
�d�0C�0K�L�L�L�L�L�
 �VY�
 �]`�dh�ij�dk�]k�]k��	�	�$������e�}�}�rc����t��}|jD]P�t�fd�|j�jD����r#|r|�dkr|�����Qt
|��S)am
        Return all leaf nodes - that is, nodes with no dependents in their app.
        These are the "most current" version of an app's schema.
        Having more than one per app is technically an error, but one that
        gets handled further up, in the interactive command - it's usually the
        result of a VCS merge and needs some user input.
        c3�<�K�|]}|d�dkV��dSr}r5r~s  �rrz,MigrationGraph.leaf_nodes.<locals>.<genexpr>�s0�����M�M��3�q�6�T�!�W�$�M�M�M�M�M�Mrr)r
rCr�rBrr,ru)rr��leavesrFs   @r�
leaf_nodeszMigrationGraph.leaf_nodes�s���������J�	!�	!�D��M�M�M�M��
�d�0C�0L�M�M�M�M�M�
!�WZ�
!�^a�ei�jk�el�^l�^l��
�
�4� � � ���f�~�~�rc���t|j��}|r�|���}|g}|r�|d}|j|jD]�}|j}||vrI||�|��d�}td�d�|D�������||vr,|�	|��|�
|��n��|���}|��|��dSdS)N���r'c3� K�|]	}d|zV��
dS)z%s.%sNr5ras  rrz3MigrationGraph.ensure_not_cyclic.<locals>.<genexpr>s'����?[�?[�PQ��!��?[�?[�?[�?[�?[�?[r)r
rCrPrBrr�indexr�joinrtrQ)r�todorFry�topr-�cycles       r�ensure_not_cyclicz MigrationGraph.ensure_not_cyclics���4�:�����	'��8�8�:�:�D��F�E��
'��B�i��!�]�3�/�8�'�'�E�!�9�D��u�}�}� %�e�k�k�$�&7�&7�&8�&8� 9��5�d�i�i�?[�?[�UZ�?[�?[�?[�6[�6[�\�\�\��t�|�|����T�*�*�*����D�)�)�)���$�
!�9�9�;�;�D��
'��	'�	'�	'�	'�	'rc�0�d|���zS)NzGraph: %s nodes, %s edges)�_nodes_and_edgesrs rr$zMigrationGraph.__str__s��*�T�-B�-B�-D�-D�D�Drc�\�|���\}}d|jj�d|�d|�d�S)Nr&z: nodes=z, edges=�>)r�r(r))rrC�edgess   rr*zMigrationGraph.__repr__s9���,�,�.�.���u�u�-1�^�-D�-D�-D�e�e�e�U�U�U�S�Src��t|j��td�|j���D����fS)Nc3�>K�|]}t|j��V��dSr)�lenr)rbrFs  rrz2MigrationGraph._nodes_and_edges.<locals>.<genexpr>"s,����#Y�#Y�$�C���$5�$5�#Y�#Y�#Y�#Y�#Y�#Yr)r�rC�sumrBrers rr�zMigrationGraph._nodes_and_edges!s:���4�:����#Y�#Y�$�-�BV�BV�BX�BX�#Y�#Y�#Y� Y� Y�Y�Yrc��g}|D]9}|�|��D]!}||vr|s||vr|�|���"�:|Sr)rmrt)rrC�at_end�planrFrEs      r�_generate_planzMigrationGraph._generate_plan$sl�����	+�	+�D�!�/�/��5�5�
+�
+�	��D�(�(�f�(�	��8N�8N��K�K�	�*�*�*��
+��rc�B�|�!t|�����}|st��St|dt��s|g}|�||��}t|���}|D]$}|j|�|d���}�%|S)z�
        Given a migration node or nodes, return a complete ProjectState for it.
        If at_end is False, return the state before the migration has run.
        If nodes is not provided, return the overall most current project state.
        Nr)�	real_appsF)�preserve)�listr�rr`�tupler�rC�mutate_state)rrCr�r�r��
project_staterFs       r�
make_statezMigrationGraph.make_state,s����=�����*�*�+�+�E��	"��>�>�!��%��(�E�*�*�	��G�E��"�"�5�&�1�1��$�y�9�9�9�
��	Y�	Y�D� �J�t�,�9�9�-�RW�9�X�X�M�M��rc��||jvSr)rC)rrFs  r�__contains__zMigrationGraph.__contains__>s���t�z�!�!rrs)Tr)NTN)r)r2r3r4rrGrIrMrXr]rKrmrprjr�r�r�r$r*r�r�r�r�r5rrr@r@=se��������,���$�$�$����
(�(�(�(�.!;�!;�!;�F 5� 5� 5�HV�V�V�9�9�9�I�I�I�����"	�	�	�	�����'�'�'�.E�E�E�T�T�T�Z�Z�Z��������$"�"�"�"�"rr@N)
�	functoolsr�django.db.migrations.stater�
exceptionsrrr	r7r@r5rr�<module>r�s���$�$�$�$�$�$�3�3�3�3�3�3�B�B�B�B�B�B�B�B�� !� !� !� !� !� !� !��� !�FR�R�R�R�R��R�R�R�"B"�B"�B"�B"�B"�B"�B"�B"�B"�B"r

Youez - 2016 - github.com/yon3zu
LinuXploit