HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/sphinx/util/__pycache__/nodes.cpython-310.pyc
o

�$�a?Y�@sdZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZddlmZddlmZmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZerpddl m!Z!dd
l"m#Z#ddl$m%Z%ddl&m'Z'e�(e)�Z*e�+dej,�Z-e-Z.Gdd�d�Z/dede0fdd�Z1d�dede2de0fdd�Z3deddfdd�Z4ej5ej6ej7ej8fZ9dede:fdd�Z;dede:fdd �Z<ej6ej7ej=ej>fZ?ej@fZAejBfZCd!edeeee0ffd"d#�ZDdede	e0fd$d%�ZEdede	e2fd&d'�ZFd�ded(edeefd)d*�ZGdede	efd+d,�ZHd!edeeeed-ffd.d/�ZId0ed1edede0fd2d3�ZJdede0fd4d5�ZKd6e0dee:e0e0ffd7d8�ZLgd9�ZMd:e0d;e0deee0e0e0e0e	e0ffd<d=�ZNd>d?d@e
e0dAe0dBejOdCedDee0dejOfdEdF�ZPdGe0de0fdHdI�ZQe�+dJ�ZRe�+dK�ZSidLdM�dNdO�dPdQ�dRdS�dTdU�dVdW�dXdY�dZdY�d[d\�d]dO�d^d_�d`da�dbdU�dcdd�dedf�dgdW�dhdW�ididj�dkdl�dmdn�dodl�dpdU�dqdd�drdW�dsdt�dud\�dvdw�dxdl�dydz�d{dt�d|d}�d~d�d�dj��ZTd�d�d�d�d�d��ZU	d�d�d�d�ejOd�e0d�e0de0f
d�d��ZVdejWd�e0de	efd�d��ZX	d�d>d?d�e0d�e0d;e0d�e
eeefd�e0dejYfd�d��ZZd�ededdfd�d��Z[d�ed�e2deddfd�d��Z\d�ed�eddfd�d��Z]ej^ej_ej`ej@ej>ejaejbfZcdede:fd�d��Zdd�ed�d�ddfd�d��Zed�edefd�d��Zfefej_gdS)�z�
    sphinx.util.nodes
    ~~~~~~~~~~~~~~~~~

    Docutils node-related utility functions for Sphinx.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�
TYPE_CHECKING�Any�Callable�Iterable�List�Optional�Set�Tuple�Type�Union�cast)�nodes)�Element�Node)�	Directive)�Inliner)�
StringList)�addnodes)�__)�logging)�Builder)�
IndexEntry)�BuildEnvironment)�Tagsz^(.+?)\s*(?<!\x00)<([^<]*?)>$c@sNeZdZdZdeededdfdd�Zdedefd	d
�Z	dedefdd�Z
dS)
�NodeMatchera%A helper class for Node.traverse().

    It checks that the given node is an instance of the specified node-classes and
    has the specified node-attributes.

    For example, following example searches ``reference`` node having ``refdomain``
    and ``reftype`` attributes::

        matcher = NodeMatcher(nodes.reference, refdomain='std', reftype='citation')
        doctree.traverse(matcher)
        # => [<reference ...>, <reference ...>, ...]

    A special value ``typing.Any`` matches any kind of node-attributes.  For example,
    following example searches ``reference`` node having ``refdomain`` attributes::

        from typing import Any
        matcher = NodeMatcher(nodes.reference, refdomain=Any)
        doctree.traverse(matcher)
        # => [<reference ...>, <reference ...>, ...]
    �node_classes�attrs�returnNcOs||_||_dS�N)�classesr)�selfrr�r!�3/usr/lib/python3/dist-packages/sphinx/util/nodes.py�__init__>s
zNodeMatcher.__init__�nodecCs�z=|jr
t||j�s
WdS|jr;t|tj�sWdS|j��D]\}}||vr*WdS|tur/q|�|�|kr:WdSqWdStyGYdSw)NFT)	r�
isinstancerr
r�itemsr�get�	Exception)r r$�key�valuer!r!r"�matchBs$��zNodeMatcher.matchcCs
|�|�Sr)r+)r r$r!r!r"�__call__Xs
zNodeMatcher.__call__)�__name__�
__module__�__qualname__�__doc__r
rrr#�boolr+r,r!r!r!r"r(s
rr$rcCsd�|j|jj�S)z�
    Return full module dotted path like: 'docutils.nodes.paragraph'

    :param nodes.Node node: target node
    :return: full module dotted path
    z{}.{})�formatr.�	__class__r-�r$r!r!r"�get_full_module_name\sr5�P�lengthcCsPz|����}Wn
tyt|�}Ynw|r&t|�|kr&|d|�d}|S)a�
    return DOM XML representation of the specified node like:
    '<paragraph translatable="False"><inline classes="versionmodified">New in version...'

    :param nodes.Node node: target node
    :param int length:
       length of return value to be striped. if false-value is specified, repr_domxml
       returns full of DOM XML representation.
    :return: DOM XML representation
    Nz...)�asdom�toxmlr(�str�len)r$r7�textr!r!r"�repr_domxmlfs�r=cCs�t|tj�r'|js't�dt|�t|��|j}|j	|_	|j
d|_
|��|_nt|tj�r5|j	s5|jj	|_	t|tj�rV|j	durVt�dt|�t|��|jj	|jj
|_	|_
t|tj
�rw|j	durwt�dt|�t|��|jj	|jj
|_	|_
t|tj�r�t�dt|�t|��tt|j�tj���D]}t�dt�|���d|j�|_q�t|tj�r�|j	dur�t|�|_	|js�|��|_|j	r�|jr�dSt|tjtj
tjtjf�r�t�dt|�t|��t|�p�d|_	d	|_
dSdS)
Nz7[i18n] PATCH: %r to have source, line and rawsource: %s�z)[i18n] PATCH: %r to have source, line: %sz#[i18n] PATCH: %r to have source: %sz&[i18n] PATCH: %r to have rawsource: %sz	\s*:\s*%s�z,[i18n] PATCH: %r to have source and line: %sr)r%r
�
classifier�	rawsource�logger�debugr5r=�parent�source�line�astext�image�title�term�reversed�list�traverse�re�sub�escape�
literal_block�get_node_source�rubric�
field_name)r$�definition_list_itemr@r!r!r"�apply_source_workaroundzs^�
����

���rVcCs0t|tj�rt|j�ddg�dtj�rdSdS)Nr
rTF)r%r
�pending�detailsr'r�metar4r!r!r"�is_pending_meta�s
�rZcCs"t|tj�rdSt|tj�r|�d�s|�d�rdSt|tj�r&d|vr&dSt|tj�r�|js<t	�
dt|�t|��dSt|t
�rRd|vrRt	�
dt|�t|��dS|�dd�set	�
dt|�t|��dSt|tj�r|jdd	krt	�
d
t|�t|��dSdSt|tj�r�dSt|�r�dSdS)NT�translatable�altFz)[i18n] SKIP %r because no node.source: %szO[i18n] SKIP %r because node is in IGNORED_NODES and no node['translatable']: %sz3[i18n] SKIP %r because not node['translatable']: %sr�orphanz&[i18n] SKIP %r because orphan node: %s)r%rr[r
rHr'�Inline�TextElementrErBrCr5r=�
IGNORED_NODESrT�childrenrYrZr4r!r!r"�is_translatable�sB ����rb�doctreeccs��|�t�D]q}t|tj�r|��D]}||fVqqt|t�r*|j}|s)|��}nFt|t	j
�rK|�d�r<||dfV|�d�rHd|d}n(d}n%t|t�rT|j
}nt|t	j�rgt|�rg|jddj
}n	|j�dd	���}|rw||fVqd
S)z3Extract translatable messages from a document tree.r\r[z
.. image:: %s�urir?r
r�
� N)rMrbr%rr[�extract_original_messages�LITERAL_TYPE_NODESrArGr
rHr'�META_TYPE_NODES�
rawcontentrWrZrX�replace�strip)rcr$�msgr!r!r"�extract_messages�s4�
�



��rncC�"t|�D]
}|jr|jSqdSr)�traverse_parentrE�r$�pnoder!r!r"rR�

�rRcCror)rprFrqr!r!r"�
get_node_line"rsrt�clsccs0�|r|dust||�r|V|j}|sdSdSr)r%rD)r$rur!r!r"rp)s��rpcCs&|j�|�}|dkr|j|dSdS)Nrr>)rD�index)r$�posr!r!r"�
get_prev_node0srxrccsD�|�ttjdd��D]}d|vr|d}n|d}||fVqdS)z6Traverse translatable index node from a document tree.F)�inline�raw_entries�entriesN)rMrrrv)rcr$r{r!r!r"�traverse_translatable_index8s�
�r|�state�contentcCsX|jj}|jj}g|j_d|j_z|j|d|dd�W||j_||j_S||j_||j_w)z�Version of state.nested_parse() that allows titles and does not require
    titles to have the same decoration as the calling document.

    This is useful when the parsed content comes from a completely different
    context, such as docstrings.
    rr>)�match_titles)�memo�title_styles�
section_level�nested_parse)r}r~r$�surrounding_title_styles�surrounding_section_levelr!r!r"�nested_parse_with_titlesBs
�
r�cCsL|��}|�tj�D]}d|d<q
t|�tj��D]}|j�|�q|��S)z&Like node.astext(), but ignore images.r?r\)	�deepcopyrMr
rHrL�rawrD�removerG)r$�imgr�r!r!r"�clean_astextUs
r�r<cCs.t�|�}|rd|�d�|�d�fSd||fS)z3Split role content into title and target, if given.Tr>�F)�explicit_title_rer+�group)r<r+r!r!r"�split_explicit_title_s

r�)�single�pair�double�triple�see�seealso�entry�targetidcCsFddlm}g}|��}|}d}|�d�rd}|dd���}|D]*}|�|d�rK|t|�dd���}||d|}|�d	|||df�|Sq!tD](}|�|d�rv|t|�dd���}|d
krid	}|�||||df�|SqN|�d�D]$}|��}d}|�d�r�d}|dd���}|s�q||�d|||df�q||S)
Nr)�pairindextypesr?�!�mainr>�:z; r�r��,r�)	�sphinx.domains.pythonr�rl�
startswith�lstripr;�append�
indextypes�split)r�r�r��indexentries�oentryr��typer*r!r!r"�process_index_entrylsF
��
r��builderr�
docnameset�docname�tree�	colorfunc�	traversedc

Csttj|���}t|�tj��D]s}g}tt	|d�}|D]^}	|	|vr{z$|�
|	�tj||	�ddd�t
|||	|j�|	�||�}
|�|	�WntyZtjtd�|	|d�Yqwtj|	d�}|
j|_|�tj�D]
}d|vru|	|d<qk|�
|�q|j�||�q|S)	zwInline all toctrees in the *tree*.

    Record all docnames in *docnameset*, and output docnames with *colorfunc*.
    �includefilesrfT)�nonlz+toctree contains ref to nonexisting file %r��location)r�r�)rr
�documentr�rLrMr�toctree�mapr:r�rB�info�inline_all_toctrees�env�get_doctree�addr(�warningr�
start_of_filera�sectionrDrk)
r�r�r�r�r�r��toctreenode�newnodesr��includefile�subtree�sof�sectionnoder!r!r"r��s:

�

���
�r��stringcCsX|�t�}|�t�}t�d|��dd��d�}t�dd�	|�
���}t�d|�}t|�S)a�Convert `string` into an identifier and return it.

    This function is a modified version of ``docutils.nodes.make_id()`` of
    docutils-0.16.

    Changes:

    * Allow to use capital alphabet characters
    * Allow to use dots (".") and underscores ("_") for an identifier
      without a leading character.

    # Author: David Goodger <goodger@python.org>
    # Maintainer: docutils-develop@lists.sourceforge.net
    # Copyright: This module has been placed in the public domain.
    �NFKD�ascii�ignore�-rfr?)
�	translate�_non_id_translate_digraphs�_non_id_translate�unicodedata�	normalize�encode�decode�
_non_id_charsrO�joinr��_non_id_at_endsr:)r��idr!r!r"�_make_id�s

r�z[^a-zA-Z0-9._]+z^[-0-9._]+|-+$��oi�di'�hi1�iiB�lig�ti��bi�i��ci�i��fi��ki�i��ni��pi�i�i��yi��zi��gi%i4i5i6i7�ji<i?�si@iG�eiIiK�qiM�riO�sz�ae�oe�db�qp)����iSi8i9r?r�rr��prefixrJcCs�d}|r	|d}n|jjpdd}|r"|r"t||�}||kr!d}n|r.t|�}|dkr.d}|dus7||jvrG||�|�}|dus7||jvs7|S)z>Generate an appropriate node_id for given *prefix* and *term*.Nz-%sr�z%sr?)�settings�	id_prefixr��ids�new_serialno)r�r�r�rJ�node_id�idformatr!r!r"�make_id�s"
��r��	conditioncCs0|D]}t|tj�r|�d�|kr|SqdS)zBPick matched pending_xref_condition node up from the pending_xref.r�N)r%r�pending_xref_conditionr')r$r��subnoder!r!r"�find_pending_xref_conditions�r��fromdocname�	todocname�childrIcCsltjdddd�}||kr|r||d<n|r"|�||�d||d<n|�||�|d<|r0||d<||7}|S)z$Shortcut to create a reference node.r?T)�internal�refid�#�refuri�reftitle)r
�	reference�get_relative_uri)r�r�r�r�r�rIr$r!r!r"�make_refnode#s

�
�r�	directivecCs|j�|j�\|_|_dSr)�
state_machine�get_source_and_line�linenorErF)rr$r!r!r"�set_source_info5s�r
�inlinerr	cCs|j�|�\|_|_dSr)�reporterrrErF)rr	r$r!r!r"�set_role_source_info:sr
�src�dstcCst|�|_t|�|_dSr)rRrErtrF)rrr!r!r"�copy_source_info>s
rcCsNt|j�D]}t|t�rdS|�dd�durdSqt|dd�dur%dSdS)z0Check whether the node is smart-quotable or not.F�support_smartquotesNT)rprDr%�NON_SMARTQUOTABLE_PARENT_NODESr'�getattrrqr!r!r"�is_smartquotableNs
�r�tagsrcCs�|�tj�D]F}z	|�|d�}Wn&ty7}ztjtd�||d�|�|j	p+t
���WYd}~qd}~ww|rE|�|j	pBt
���q|�t
���qdS)z0Filter ``only`` nodes which do not match *tags*.�exprz8exception while evaluating only directive expression: %sr�N)rMr�only�eval_conditionr(rBr�r�replace_selfrar
�comment)r�rr$�ret�errr!r!r"�process_only_nodes\s� ���rr cCs6|j|jfi|j��}t|tj�r|j|_|j|_|S)z�monkey-patch Element.copy to copy the rawsource and line
    for docutils-0.16 or older versions.

    refs: https://sourceforge.net/p/docutils/patches/165/
    )r3rA�
attributesr%r
rrErF)r �newnoder!r!r"�	_new_copyps
r )r6r)r?N)hr0rNr��typingrrrrrrrr	r
rr�docutilsr
�docutils.nodesrr�docutils.parsers.rstr�docutils.parsers.rst.statesr�docutils.statemachiner�sphinxr�
sphinx.localer�sphinx.utilr�sphinx.buildersr�
sphinx.domainr�sphinx.environmentr�sphinx.util.tagsr�	getLoggerr-rB�compile�DOTALLr��caption_ref_rerr:r5�intr=rV�	InvisiblerQ�
doctest_block�versionmodifiedr`r1rZrb�
math_blockr�rhrH�IMAGE_TYPE_NODESrYrirnrRrtrprxr|r�r�r�r�r�r�r�r�r�r�r�r�r��pending_xrefr�rrr
r
r�FixedTextElement�literal�math�problematic�not_smartquotablerrrr �copyr!r!r!r"�<module>sX
4
4
:�	,���"



�'���
�"

��������	�
���
������������������� �!�$�
���
�
����
��