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/docutils/parsers/rst/directives/__pycache__/misc.cpython-310.pyc
o

f'ha�d�@sTdZdZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZddlm
Z
mZddlmZddlmZmZddlmZmZmZdd	lmZmZdd
lmZddlmZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#Gdd�de�Z$Gdd�de�Z%Gdd�de�Z&dS) zMiscellaneous directives.�reStructuredText�N)�io�nodes�statemachine�utils)�
SafeString�ErrorString)�locale_encoding)�	Directive�convert_directive_function)�
directives�roles�states)�	CodeBlock�NumberLines)�set_classes)�miscc
@sjeZdZdZdZdZdZejej	ej
ejeeeej
ej
ej	ejej	d�Zej�e�ej�d�Zdd�Zd	S)
�Includea]
    Include content read from a separate source file.

    Content may be parsed by the parser, or included as a literal
    block.  The encoding of the included file can be specified.  Only
    a part of the given file argument may be included by specifying
    start and end line or text to match before and/or after the text
    to be used.
    �rT)�literal�code�encoding�parser�	tab-width�
start-line�end-line�start-after�
end-before�number-lines�class�name�includecsf�jjjjs��d�j���jj��j	�jj
d�}tj�
tj�|��}t��jd�}|�d�rD|�d�rDtj��j|dd��}tj�tj�||��}t�d|�}t�|�}�j�d�jjjj�}�jjjj}�j�d	�jjjj�}z�jjjj� |�t!j"|||d
�}Wn/t#y�}z��$d�jt%|�f��d}~wt&y�}z��$d�jt'|�f��d}~ww�j�d
d�}	�j�dd�}
z|	s�|
dur�|�(�}d�||	|
��}n|�)�}Wnt*y�}z��$d�jt'|�f��d}~ww�j�dd�}
|
�r |�+|
�}|dk�r��$d�j��||t,|
�d�}�j�dd�}|�rB|�+|�}|dk�r<��$d�j��|d|�}t-j.||dd��t/��D]\}}t,|��jjjj0k�rh��d||df���qNd�jv�r�|dk�r{|�1|�}n|}tj2||�j�dg�d�}d|_3��4|�d�jv�r�zt5�jd�p�d�}	Wn
t6�y���7d��w|	t,��}
|�d��r�|dd�}t8g|fg|	|
�}|D]\}}|�r�|tj9|||d�7}�q�|t�:|�7}�q�|gS|t�:|�7}|gSd�jv�r(|�jd <|dk�r|�;��t<�j�j�=d�g�j��j	�j>�j?�j�j�	}|�@�Sd!�jv�rI�jd!�}t�A|�jjj�}|�Bd���|�|jCSt�d|�}|	|
||
f}�jjjD}|�sf|d"tEjFd#fg}�fd$d%�|D�}||fd&d%�|D�v�r���d'�jd(�|gd)d%�|ddd�D��f���j�G�|�|�H||�j	f��fd*d%�|D��jj_DgS)+z8Include a file as part of the content of this reST file.�"%s" directive disabled.rr�<�>���Nrr��source_pathr�
error_handlerzVProblems with "%s" directive path:
Cannot encode input file path "%s" (wrong locale?).�&Problems with "%s" directive path:
%s.rr��Problem with "%s" directive:
%srzDProblem with "start-after" option of "%s" directive:
Text not found.rzCProblem with "end-before" option of "%s" directive:
Text not found.T)�convert_whitespacez,"%s": line %d exceeds the line-length-limit.rr)�source�classesrz+:number-lines: with non-integer start value�
)r.rr-r)NNNN�csg|]}|d�jkr|�qS�r0)�lineno)�.0�entry��self��F/usr/lib/python3/dist-packages/docutils/parsers/rst/directives/misc.py�
<listcomp>�s�zInclude.run.<locals>.<listcomp>cSsg|]	\}}}||f�qSr7r7�r3�pth�opt�er7r7r8r9�s�z(circular inclusion in "%s" directive: %sz < cSsg|]\}}}|�qSr7r7r:r7r7r8r9�scs(g|]\}}}|||t��df�qSr1)�lenr:)�
include_linesr7r8r9�s�)I�state�document�settings�file_insertion_enabled�warningr �
state_machine�input_linesr-r2�input_offset�os�path�dirname�abspathr�	arguments�
startswith�endswith�join�standard_include_path�normpathr�
relative_pathr�reprunicode�options�get�input_encoding�input_encoding_error_handler�	tab_width�record_dependencies�addr�	FileInput�UnicodeEncodeError�severer�IOErrorr�	readlines�read�UnicodeError�findr>r�string2lines�	enumerate�line_length_limit�
expandtabs�
literal_block�line�add_name�int�
ValueError�errorr�inline�Text�
splitlinesr�pop�content_offset�
block_text�run�new_document�parse�children�include_log�sys�maxsize�insert_input�append)r6r-�
source_dirrIr�	e_handlerrX�include_filerl�	startline�endline�lines�rawtext�
after_text�after_index�before_text�before_index�irh�textrg�tokensr.�value�	codeblockrrA�clip_optionsrwr7)r?r6r8rs7s�
��
����������

�

��
��
�

�
��

�	

�
��
�zInclude.runN)�__name__�
__module__�__qualname__�__doc__�required_arguments�optional_arguments�final_argument_whitespacer�flag�	unchangedr�parser_namerj�unchanged_required�class_option�option_specrHrIrO�docutils�_datadirr�__file__rPrsr7r7r7r8rs,
��rc@s:eZdZdZdZdZdZejej	ej
d�ZdZdd�Z
dS)	�Rawz�
    Pass through content unchanged

    Content is included in output based on type argument

    Content may be included inline (content section of directive) or
    imported from a file or url.
    rrT)�file�urlrc
Cs�|jjjjr|jjjjsd|jvsd|jvr|�d|j��dd�|j	d�
����i}|j�d|jjjj
�}|jjjj}|jrZd|jvsJd|jvrR|�d|j��d	�|j�}�nd|jvr�d|jvrl|�d
|j��tj�tj�|jjj��}tj�tj�||jd��}t�d|�}ztj|||d�}|jjjj�|�Wnty�}z|�d|jt|�f��d}~wwz|� �}Wnt!y�}z|�d
|jt|�f��d}~ww||d<n�d|jv�rY|jd}	t"j#dkr�ddl$m%}
ddl&m'}nddl(m%}
m'}z|
|	�� �}Wn |tt)f�y*}z|�d|j|jdt|�f��d}~wwtj*||	||d�}z|� �}Wnt!�yS}z|�d
|jt|�f��d}~ww|	|d<n|�+�t,j-d|fi|��}
|j.�/|j0�\|
_1|
_2|
gS)Nr�r�r"�format� rrzF"%s" directive may not both specify an external file and have content.r/zXThe "file" and "url" options may not be simultaneously specified for the "%s" directive.r&r)r+r-��r)�urlopen)�URLError)r�r�z*Problems with "%s" directive URL "%s":
%s.)r-r'rr(r*)3r@rArB�raw_enabledrCrTrDr rOrL�lower�splitrUrVrW�contentrlrHrIrJrK�current_sourcerQrrRrr[rYrZr^r]rr`rarx�version_info�urllib.requestr��urllib.errorr��urllib2�OSError�StringInput�assert_has_contentr�rawrE�get_source_and_liner2r-rh)r6�
attributesrr}r�r|rI�raw_filerlr-r�r��raw_text�raw_noder7r7r8rs�s�
�

���

�����������


�������
�zRaw.runN)r�r�r�r�r�r�r�rrI�urirr��has_contentrsr7r7r7r8r��s	�r�c@�eZdZdZdd�ZdS)�ReplaceTcCs�t|jtj�s|�d|j��|��d�|j�}t	�
|�}|j�|j|j|�d}g}|D],}|s;t|t	j
�r;|}q.t|t	j�rKg|d<|�|�q.|jjjd|j|jd�gS|rb||jS|S)N�VInvalid context: the "%s" directive can only be used within a substitution definition.r/�backrefsz=Error in "%s" directive: may contain a single paragraph only.�rh)�
isinstancer@r�SubstitutionDefrlr r�rOr�r�Element�nested_parserq�	paragraph�system_messager{rE�reporterr2rv)r6r��element�node�messages�elemr7r7r8rs.s<��
����
zReplace.runN�r�r�r�r�rsr7r7r7r8r�*�r�c@s@eZdZdZdZdZdZejejejd�Z	e
�d�Zdd�Z
d	S)
�Unicodea{
    Convert Unicode character codes (numbers) to characters.  Codes may be
    decimal numbers, hexadecimal numbers (prefixed by ``0x``, ``x``, ``\x``,
    ``U+``, ``u``, or ``\u``; e.g. ``U+262E``), or XML-style numeric character
    entities (e.g. ``&#x262E;``).  Text following ".." is a comment and is
    ignored.  Spaces are ignored, and any other text remains as-is.
    rrT)�trim�ltrim�rtrimz
( |\n|^)\.\. cCs�t|jtj�s|�d|j��|jj}d|jvr"d|j	d<d|j	d<d|jvr,d|j	d<d|jvr6d|j	d<|j
�|jd�d��}t
��}|D](}zt�|�}Wntyi}z|�d|t|�f��d}~ww|t
�|�7}qI|jS)Nr�r�rr�r�rzInvalid character code: %s
%s)r�r@rr�rlr rEr�rTr��comment_patternr�rLrr�r�unicode_coderkrrnrv)r6�substitution_definition�codesr�r�decodedrlr7r7r8rs]s6��







���zUnicode.runN)r�r�r�r�r�r�r�rr�r��re�compiler�rsr7r7r7r8r�Js�
r�c@s(eZdZdZdZdZdZdZdd�ZdS)�Classz�
    Set a "class" attribute on the directive content or the next element.
    When applied to the next element, a "pending" element is inserted, and a
    transform does the work later.
    rrTc	Cs�z
t�|jd�}Wnty|�d|j|jdf��wg}|jrFt��}|j	�
|j|j|�|D]	}|d�|�q4|�|j
�|St�tj||jd�|j�}|jj�|�|�|�|S)Nrz7Invalid class attribute value for "%s" directive: "%s".r.)r�	directive)rr�rLrkrlr r�rr�r@r�rq�extendrv�pendingr�ClassAttributerrrErA�note_pendingr{)r6�class_value�	node_list�	containerr�r�r7r7r8rs�s6�����
�
z	Class.runN)	r�r�r�r�r�r�r�r�rsr7r7r7r8r�vsr�c@s0eZdZdZe�dejjfd�Z	dd�Z
dS)�RoleTz(%s)\s*(\(\s*(%s)\s*\)\s*)?$r0c
Cs|j|jks	|js|�d|j��|jd}|j�|�}|s(|�d|j|f��|�d�}|�d�}g}|rbt�	||j
j|j|jj
�\}}|dura|jj
jd|t�|j|j�|jd�}||gSntj}t|d	�rsJd
|j|f��zt|�}|jj|jdd�|j|id�\}	}
}}Wn.tjy�}
z!|j
j
jd|j|
ft�|j|j�|jd�}||gWYd}
~
Sd}
~
wwd
|
vr�z	t�|�|
d
<Wn/ty�}
z#|j
j
jd|jt|
�ft�|j|j�|jd�}||gWYd}
~
Sd}
~
wwt�|||
|�}t�||�|S)z?Dynamically create and register a custom interpreted text role.z4"%s" directive requires arguments on the first line.rz4"%s" directive arguments not valid role names: "%s".rr�N�#Unknown interpreted text role "%s".r�rLz[Supplemental directive arguments for "%s" directive not supported (specified by "%r" role).)�option_presetszError in "%s" directive:
%s.rz(Invalid argument for "%s" directive:
%s.)rqr2r�rlr �argument_pattern�match�groupr
�rolerE�languager@r�rrgrr�generic_custom_role�hasattrr�parse_directive_blockr�MarkupErrorrr�rkr�
CustomRole�register_local_role)r6�argsr��
new_role_name�base_role_namer��	base_rolerl�converted_rolerLrTr�rq�detailr�r7r7r8rs�s��
�

��
�������������zRole.runN)r�r�r�r�r�r�r�Inliner�
simplenamer�rsr7r7r7r8r��s�r�c@� eZdZdZdZdZdd�ZdS)�DefaultRolez&Set the default interpreted text role.rFcCs�|jsdtjvrtjd=gS|jd}t�||jj|j|jj�\}}|dur>|jjj	d|t
�|j|j�|jd�}||gS|tjd<|S)Nr*rr�r�)
rLr
�_rolesr�rEr�r2r@r�rlrrgrr)r6�	role_namer�r�rlr7r7r8rs�s"


��

zDefaultRole.runN)r�r�r�r�r�r�rsr7r7r7r8r��s
r�c@r�)�TitlerrTcCs|jd|jjd<gS)Nr�title)rLrErAr5r7r7r8rs�sz	Title.runN)r�r�r�r�r�r�rsr7r7r7r8r��s
r�c@r�)�DateTcCs�t|jtj�s|�d|j��d�|j�pd}tj	dkr4z	|�
tp"d�}Wnty3|�
dt��wt�|�}tj	dkr`z	|�tpDd�}Wnty_|�tpSdd�}|�
d|tf��wt�|�gS)	Nr�r/z%Y-%m-%dr�zutf-8z;Cannot encode date format string with locale encoding "%s".�replacez-Error decoding "%s"with locale encoding "%s".)r�r@rr�rlr rOr�rxr��encoder	r\rD�time�strftime�decode�UnicodeDecodeErrorrrn)r6�
format_strr�r7r7r8rss4��
��

��zDate.runNr�r7r7r7r8r��r�r�c@s.eZdZdZdZdZdejiZdZ	dd�Z
dS)�
TestDirectivez3This directive is useful only for testing purposes.rT�optioncCsp|jr#d�|j�}|jjjd|j|j|jft�	||�|j
d�}|gS|jjjd|j|j|jf|j
d�}|gS)Nr/zBDirective processed. Type="%s", arguments=%r, options=%r, content:r�zGDirective processed. Type="%s", arguments=%r, options=%r, content: None)r�rOrEr��infor rLrTrrgr2)r6r�rr7r7r8rs3s ��	���zTestDirective.runN)r�r�r�r�r�r�rr�r�r�rsr7r7r7r8r*s
r)'r��
__docformat__rx�os.pathrHr�r�r�rrrr�docutils.utils.error_reportingrrr	�docutils.parsers.rstr
rrr
r�$docutils.parsers.rst.directives.bodyrr�docutils.parsers.rst.rolesr�docutils.transformsrrr�r�r�r�r�r�r�r�rr7r7r7r8�<module>s46^ ,&=,