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: //usr/lib/python3/dist-packages/sphinx/ext/__pycache__/intersphinx.cpython-310.pyc
o

�$�aT�@s�dZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZm
Z
mZmZddlmZmZddlmZddlmZmZddlmZddlZdd	lmZdd
lmZddlm Z ddl!m"Z"dd
l#m$Z$ddl%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,ddl-m.Z.ddl/m0Z0m1Z1e+�2e3�Z4Gdd�d�Z5de6de6fdd�Z7dQde6de"de
fdd�Z8de6de6fdd�Z9dede6d edefd!d"�Z:d#e6de6d$ed%eded&e;de<fd'd(�Z=deddfd)d*�Z>d+e$d,ee6d-e1d.ed/edefd0d1�Z?d,ee6d2e0d+e$d3e
e6d4e6d.ed/edeefd5d6�Z@d7e&d,ee6d2e0d8e<d+e$d3e
e6d.ed/edeefd9d:�ZAd7e&d,ee6d2e0d8e<d.ed/edeefd;d<�ZBd7e&d,e6de<fd=d>�ZCd7e&d,e6d.ed/edeef
d?d@�ZDd7e&d8e<d.ed/edeef
dAdB�ZEd7e&d.ed/edeefdCdD�ZFded7e&d.ed/edeef
dEdF�ZGdede"ddfdGdH�ZHdedee6effdIdJ�ZIdKe
e6ddfdLdM�ZJe3dNk�r�ddl+ZKeK�L�eJejMdOd�dP�dSdS)Ra�
    sphinx.ext.intersphinx
    ~~~~~~~~~~~~~~~~~~~~~~

    Insert links to objects documented in remote Sphinx documentation.

    This works as follows:

    * Each Sphinx HTML build creates a file named "objects.inv" that contains a
      mapping from object names to URIs relative to the HTML set's root.

    * Projects using the Intersphinx extension can specify links to such mapping
      files in the `intersphinx_mapping` config value.  The mapping will then be
      used to resolve otherwise missing references to objects into links to the
      other documentation.

    * By default, the mapping file is assumed to be at the same location as the
      rest of the documentation; however, the location of the mapping file can
      also be specified individually, e.g. if the docs should be buildable
      without Internet access.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�path)�IO�Any�Dict�List�Optional�Tuple)�urlsplit�
urlunsplit)�nodes)�Element�TextElement)�
relative_path)�pending_xref)�Sphinx)�INVENTORY_FILENAME)�Config)�Domain)�BuildEnvironment)�_�__)�logging�requests)�
InventoryFile)�	Inventory�
InventoryItemc@s|eZdZdZdeddfdd�Zedeee	ee
efffdd��Zedefd	d
��Z
edeeeffdd��Zdd
d�ZdS)�InventoryAdapterz!Inventory adapter for environment�env�returnNcCs0||_t|d�si|j_i|j_i|j_dSdS)N�intersphinx_cache)r�hasattrr�intersphinx_inventory�intersphinx_named_inventory)�selfr�r$�8/usr/lib/python3/dist-packages/sphinx/ext/intersphinx.py�__init__9s
�zInventoryAdapter.__init__cC�|jjS�N)rr�r#r$r$r%�cacheA�zInventoryAdapter.cachecCr'r()rr!r)r$r$r%�main_inventoryEr+zInventoryAdapter.main_inventorycCr'r()rr"r)r$r$r%�named_inventoryIr+z InventoryAdapter.named_inventorycCs|jj��|jj��dSr()rr!�clearr"r)r$r$r%r.MszInventoryAdapter.clear)rN)�__name__�
__module__�__qualname__�__doc__rr&�propertyr�strr�intrr*r,r-r.r$r$r$r%r6s"r�urlrcCs6tt|��}d|dvr|d�d�d|d<t|�S)a�Returns *url* with basic auth credentials removed. Also returns the
    basic auth username and password if they're present in *url*.

    E.g.: https://user:pass@example.com => https://example.com

    *url* need not include basic auth credentials.

    :param url: url which may or may not contain basic auth credentials
    :type url: ``str``

    :return: *url* with any basic auth creds removed
    :rtype: ``str``
    �@�)�listr	�splitr
)r6�fragsr$r$r%�_strip_basic_authRsr<�configcCsBtj|d||jd�}|��|j|j_tj|jjdd�|j_|jS)u�Reads data from *url* with an HTTP *GET*.

    This function supports fetching from resources which use basic HTTP auth as
    laid out by RFC1738 § 3.1. See § 5 for grammar definitions for URLs.

    .. seealso:

       https://www.ietf.org/rfc/rfc1738.txt

    :param url: URL of an HTTP resource
    :type url: ``str``

    :return: data read from resource described by *url*
    :rtype: ``file``-like object
    T)�streamr=�timeout)�decode_content)	r�get�intersphinx_timeout�raise_for_statusr6�raw�	functools�partial�read)r6r=�rr$r$r%�_read_from_urlgs

rIcCs`t|�}|jdur|St|�}|jr"d�|j|j|j�|d<t|�Sd�|j|j�|d<t|�S)a5Gets version of *url* with basic auth passwords obscured. This function
    returns results suitable for printing and logging.

    E.g.: https://user:12345@example.com => https://user@example.com

    :param url: a url
    :type url: ``str``

    :return: *url* with password removed
    :rtype: ``str``
    Nz{}@{}:{}r8z{}@{})r	�usernamer9�port�format�hostnamer
)r6�partsr;r$r$r%�
_get_safe_url�s
�rO�app�uri�invc
Cspd|v}|s
t|�}zd|vrt||jd�}n
tt�|j|�d�}Wnty9}zd||jt	|�f|_
�d}~wwzet|d�rd|j}||krdt
�td�||�||t�|�t�|�dfvrdt�|�}|�/z|rmtjntj}t�|||�}Wnty�}	ztd	|	�|	�d}	~	wwWd�W|S1s�wYW|Sty�}zd
||jjt	|�f|_
�d}~ww)z6Fetch, parse and return an intersphinx inventory file.�://)r=�rbz4intersphinx inventory %r not fetchable due to %s: %sNr6z)intersphinx inventory has moved: %s -> %s�/z,unknown or unsupported inventory version: %rz3intersphinx inventory %r not readable due to %s: %s)r<rIr=�openr�join�srcdir�	Exception�	__class__r4�argsr r6�logger�infor�dirname�	posixpathr�load�
ValueErrorr/)
rPrQrR�localuri�f�err�newinvrW�invdata�excr$r$r%�fetch_inventory�sT����

���������rh�name�invsr*�nowcCs||jjd}g}z�|D]�}|st�|t�}d|vs'||vs'||d|kr�t|�}	t�td�|	�zt	|||�}
Wnt
yS}z|�|j�WYd}~q
d}~ww|
r�|||
f||<W|gkred
St
|�t
|�kr�t�td��|D]}tj|�qvd
Sd�dd�|D��}
t�td	�d|
�d
Sq
W|gkr�dSt
|�t
|�kr�t�td��|D]}tj|�q�dSd�dd�|D��}
t�td	�d|
�dS|gkr�wt
|�t
|�kr�t�td��|D]}tj|�q�wd�dd�|D��}
t�td	�d|
�w)Ni�QrSr8z(loading intersphinx inventory from %s...zXencountered some issues with some of the inventories, but they had working alternatives:�
cSs g|]}|d|dd��qS)rr8Nr$��.0rcr$r$r%�
<listcomp>�s z)fetch_inventory_group.<locals>.<listcomp>zAfailed to reach any of the inventories with the following issues:TF)r=�intersphinx_cache_limitr_rWrrOr\r]rrhrY�appendr[�len�warning)rirQrjr*rPrk�
cache_time�failuresrR�safe_inv_urlrfrd�fail�issuesr$r$r%�fetch_inventory_group�sx ���
�
����
�
���
��ryc
Cs"tt���}t|jj�}tj���1}g}|jj	�
�D]\}\}}|�|�t
||||j||��qdd�tj�|�D�}Wd�n1sEwYt|�r�|��t|j�
��}	tdd�|	D��}
dd�|	D�}|
|D]!\}}}
|ry|
|j|<|
��D]\}}|j�|i��|�q}qmdSdS)z3Load all intersphinx mappings into the environment.cSsg|]}|���qSr$)�resultrmr$r$r%ro�sz!load_mappings.<locals>.<listcomp>Ncss�|]	}|dr|VqdS)rNr$�rn�vr$r$r%�	<genexpr>�s�z load_mappings.<locals>.<genexpr>cSsg|]}|ds|�qS)rr$r{r$r$r%ro��)r5�timer�builderr�
concurrent�futures�ThreadPoolExecutorr=�intersphinx_mapping�valuesrq�submitryr*�as_completed�anyr.r9�sortedr-�itemsr,�
setdefault�update)rPrk�inventories�poolr�rirQrj�updated�cached_vals�
named_vals�unnamed_vals�_xrf�type�objectsr$r$r%�
load_mappings�s.��	
��
r��domain�inv_name�data�node�contnodecCs|\}}}}d|vr|�d�rt�t|dd�|�}|r%td�||f}	ntd�|f}	tjddd||	d�}
|�d	�rB|
�|�|
S|d
ksQ|jdkr�|dd
kr�|�	�}|dur{|�
|d�r{|
�|�|t|�dd�|t|�dd���|
S|
�|�|
S|
�|�||��|
S)NrS�refdoc�.z(in %s v%s)z(in %s)�F)�internal�refuri�reftitle�refexplicit�-�std�reftype�keyword�:r8)
rArrWrrr�	referencerqri�astext�
startswithrZrr)r�r�r�r�r��proj�versionrQ�dispnamer��newnode�titler$r$r%�_create_element_from_results,


��
��r��	inventory�objtypes�targetc
s�|D]A}||vr	q|||vr|||}n$|dkr9|���tt�fdd�||����}	|	r8|||	d}nqqt|||||�SdS)Nzstd:termcs|���kSr()�lower)�k��target_lowerr$r%�<lambda>4sz8_resolve_reference_in_domain_by_target.<locals>.<lambda>r)r�r9�filter�keysr�)
r�r�r�r�r�r�r��objtyper��insensitive_matchesr$r�r%�&_resolve_reference_in_domain_by_target$s 
�r�r�honor_disabled_refsc
s��jdkrd|vr|�d��jdkrd|vr|�d��fdd�|D�}|r4|jj��fd	d�|D�}t||�||d
||�}|durF|S��|�}	|	durQdSt||�||	||�S)Nr��	cmdoption�option�py�	attribute�methodcsg|]	}d��j|��qS)z{}:{})rLri)rn�t)r�r$r%roSsz0_resolve_reference_in_domain.<locals>.<listcomp>csg|]}|�vr|�qSr$r$)rn�o)�disabledr$r%roXr~�	reftarget)rirqr=�intersphinx_disabled_reftypesr��get_full_qualified_name)
rr�r�r�r�r�r�r��res�full_qualified_namer$)r�r�r%�_resolve_reference_in_domainDs&



�

�r�c
Cs�|o|du}|rd|jjvrdS|d}|dkrG|j��D]'\}}|r,|d|jjvr,qt|j�}	t||||||	||�}
|
durD|
SqdS|�d�}|sPdS|r\|d|jjvr\dS|�|�}|�	|�}	|	sjdSt||||||	||�S)N�*r�r�z:*�	refdomain)
r=r��domainsr�r9�object_typesr�rA�
get_domain�objtypes_for_role)rr�r�r�r�r��typ�domain_namer�r�r�r$r$r%�_resolve_referencehsD
��


�r�cCs|t|�jvSr()rr-)rr�r$r$r%�inventory_exists�sr�cCs*t||�sJ�t||t|�j|d||�S)z�Attempt to resolve a missing reference via intersphinx references.

    Resolution is tried in the given inventory with the target as is.

    Requires ``inventory_exists(env, inv_name)``.
    F)r�r�rr-)rr�r�r�r$r$r%�resolve_reference_in_inventory�s
�r�cCst|dt|�j|||�S)z�Attempt to resolve a missing reference via intersphinx references.

    Resolution is tried with the target as is in any inventory.
    N)r�rr,)rr�r�r�r$r$r%�resolve_reference_any_inventory�s�r�cCsnt|d||�}|dur
|S|d}d|vrdS|�dd�\}}t||�s&dS||d<t||||�}||d<|S)agAttempt to resolve a missing reference via intersphinx references.

    Resolution is tried first with the target as is in any inventory.
    If this does not succeed, then the target is split by the first ``:``,
    to form ``inv_name:newtarget``. If ``inv_name`` is a named inventory, then resolution
    is tried in that inventory with the new target.
    TNr�r�r8)r�r:r�r�)rr�r�r�r�r��	newtarget�res_invr$r$r%�"resolve_reference_detect_inventory�s
r�cCst|||�S)zBAttempt to resolve a missing reference via intersphinx references.)r�)rPrr�r�r$r$r%�missing_reference�sr�cCs�|j����D]l\}}zGt|ttf�r0||}\}}t|t�s/t�t	d�|�|j�
|�Wqnd||}}}t|t�sH|||fff|j|<n	|||ff|j|<Wqtys}zt�t	d�||�|j�
|�WYd}~qd}~wwdS)Nz0intersphinx identifier %r is not string. Ignoredz3Failed to read intersphinx_mapping[%s], ignored: %r)r��copyr��
isinstancer9�tupler4r\rsr�poprY)rPr=�key�valuerirQrRrgr$r$r%�normalize_intersphinx_mapping�s,

��
����r�cCsn|�did�|�ddd�|�ddd�|�dgd�|jdtd	d
�|�dt�|�dt�tjd
dd�S)Nr�Trp�FrBr�z
config-initedi )�priorityzbuilder-initedzmissing-referencer8)r��env_version�parallel_read_safe)�add_config_value�connectr�r�r��sphinx�__display_version__)rPr$r$r%�setup�s�r��argvc
s6t|�dkrtdtjd�t�d�Gdd�d��G�fdd�d�}z?|d}t|�d	|�}t|p2i�D]*}t|�t||���D]\}}td
||ddkrUd
|dnd	|df�qBq4WdSty�}zt|j	d|j	dd��WYd}~dSd}~wt
y�}z
td|�WYd}~dSd}~ww)z-Debug functionality to print out an inventoryr8zXPrint out an inventory file.
Error: must specify local path or URL to an inventory file.��filec@s"eZdZUdZeed<dZdZdS)z inspect_main.<locals>.MockConfigNrBF)r/r0r1rBr5�__annotations__�
tls_verify�
user_agentr$r$r$r%�
MockConfigs
r�cs(eZdZdZ��Zdeddfdd�ZdS)zinspect_main.<locals>.MockAppr��msgrNcSst|tjd�dS)Nr�)�print�sys�stderr)r#r�r$r$r%�warn
sz"inspect_main.<locals>.MockApp.warn)r/r0r1rXr=r4r�r$�r�r$r%�MockApp	sr�rr�z	%-40s %s%s�r�z%-40s: �NzUnknown error: %r)rrr�r�r��exitrhr�r�rar[rY)r�r��filenamerfr��entry�einforgr$r�r%�inspect_main�s4�

���*���r�__main__r8)r�r()Nr2�concurrent.futuresr�rEr_r�r�osr�typingrrrrrr�urllib.parser	r
�docutilsr�docutils.nodesrr
�docutils.utilsrr��sphinx.addnodesr�sphinx.applicationr�sphinx.builders.htmlr�
sphinx.configr�sphinx.domainsr�sphinx.environmentr�
sphinx.localerr�sphinx.utilrr�sphinx.util.inventoryr�sphinx.util.typingrr�	getLoggerr/r\rr4r<rIrOrh�float�boolryr�r�r�r�r�r�r�r�r�r�r�r�r�_logging�basicConfigr�r$r$r$r%�<module>s 
'������
�%!���
��������
� �������
�$���
�)���
����
�
��
��
�
#�