HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/docutils/parsers/rst/directives/__pycache__/misc.cpython-36.opt-1.pyc
3

u2�e�\�@sLdZdZddlZddlZddlZddlZddlmZm	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.ZreStructuredText�N)�io�nodes�statemachine�utils)�
SafeString�ErrorString)�locale_encoding)�	Directive�convert_directive_function)�
directives�roles�states)�	CodeBlock�NumberLines)�set_classes)�miscc@sheZdZdZdZdZdZejej	ej
eeeejejej	ej
ej	d�Zejjejjej�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�encodingz	tab-widthz
start-linezend-linezstart-afterz
end-beforeznumber-lines�class�name�includec.Cs@|jjjjs|jd|j��|jjj|j	|jj
d�}tjj
tjj|��}tj|jd�}|jd�r�|jd�r�tjj|j|dd��}tjjtjj||��}tjd|�}tj|�}|jjd|jjjj�}|jjjj}|jjd|jjjj�}y&|jjjjj |�t!j"|||d	�}Wnvt#k
�rN}z|j$d
|jt%|�f��WYdd}~Xn<t&k
�r�}z|j$d|jt'|�f��WYdd}~XnX|jjdd�}	|jjd
d�}
y8|	�s�|
dk	�r�|j(�}dj||	|
��}n|j)�}Wn<t*k
�r}z|j$d|jt'|�f��WYdd}~XnX|jjdd�}
|
�rh|j+|
�}|dk�rT|j$d|j��||t,|
�d�}|jjdd�}|�r�|j+|�}|dk�r�|j$d|j��|d|�}t-j.||dd�}d|jk�r�|dk�r�|j/|�}n|}tj0|||jjdg�d�}d|_1|j2|�d|jk�r�yt3|jd�p*d�}	Wn t4k
�rP|j5d��YnX|	t,|�}
|jd��rv|dd �}t6g|fg|	|
�}xP|D]6\}}|�r�|tj7|||d�7}n|tj8||�7}�q�Wn|tj8||�7}|gSd|jk�r.||jd<t9|j|jj:d�g|j||j	|j;|j<|j|j�	}|j=�S|jj>||�gS)!z8Include a file as part of the content of this reST file.z"%s" directive disabled.rr�<�>Nrz	tab-width)�source_pathr�
error_handlerzVProblems with "%s" directive path:
Cannot encode input file path "%s" (wrong locale?).z&Problems with "%s" directive path:
%s.z
start-linezend-line�zProblem with "%s" directive:
%szstart-afterzDProblem with "start-after" option of "%s" directive:
Text not found.z
end-beforezCProblem with "end-before" option of "%s" directive:
Text not found.T)Zconvert_whitespacerr)�source�classesznumber-linesz+:number-lines: with non-integer start value�
)r rr���r")?�state�document�settings�file_insertion_enabled�warningr�
state_machineZinput_linesr�linenoZinput_offset�os�path�dirname�abspathr�	arguments�
startswith�endswith�join�standard_include_path�normpathr�
relative_pathrZreprunicode�options�get�input_encoding�input_encoding_error_handler�	tab_width�record_dependencies�addr�	FileInput�UnicodeEncodeError�severer�IOErrorr�	readlines�read�UnicodeError�find�lenrZstring2lines�
expandtabs�
literal_block�lineZadd_name�int�
ValueError�errorrZinline�Textr�pop�content_offset�
block_text�runZinsert_input)�selfr�
source_dirr+r�	e_handlerr9Zinclude_filerJ�	startlineZendline�linesZrawtextZ
after_textZafter_indexZbefore_textZbefore_indexZ
include_lines�textrF�tokensr �valueZ	codeblock�rX�/usr/lib/python3.6/misc.pyrO5s�
"$$









zInclude.runN)�__name__�
__module__�__qualname__�__doc__�required_arguments�optional_arguments�final_argument_whitespacer�flagZ	unchangedrrH�unchanged_required�class_option�option_specr*r+r1r,r
�__file__r2rOrXrXrXrYrs$

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|jjjjs0|jjjjr@d|jks0d|jkr@|jd|j��ddj|j	dj
�j��i}|jjd|jjjj
�}|jjjj}|jr�d|jks�d|jkr�|jd|j��d	j|j�}�n"d|jk�r�d|jkr�|jd
|j��tjjtjj|jjj��}tjjtjj||jd��}tjd|�}y&tj|||d�}|jjjjj|�Wn<tk
�r�}z|jd|jt|�f��WYdd}~XnXy|j �}Wn<t!k
�r�}z|jd
|jt|�f��WYdd}~XnX||d<�nd|jk�r�|jd}	ddl"}
ddl#}
ddl$}
y|
j%j&|	�j �}WnN|
jj'tt(fk
�rj}z&|jd|j|jdt|�f��WYdd}~XnXtj)||	||d�}y|j �}Wn<t!k
�r�}z|jd
|jt|�f��WYdd}~XnX|	|d<n|j*�t+j,d|f|�}|j-j.|j/�\|_0|_1|gS)Nrgrhz"%s" directive disabled.�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.)rrrz&Problems with "%s" directive path:
%s.zProblem with "%s" directive:
%srz*Problems with "%s" directive URL "%s":
%s.)rrrrr)2r#r$r%Zraw_enabledr&r5r'rr1r.�lower�splitr6r7r8�contentrJr*r+r,r-Zcurrent_sourcer3rr4rr<r:r;r?r>rrArBZurllib.requestZurllib.errorZurllib.parseZrequestZurlopenZURLError�OSErrorZStringInput�assert_has_contentr�rawr(Zget_source_and_liner)rrG)
rP�
attributesrrRrUrQr+Zraw_filerJrZurllibZraw_textZraw_noderXrXrYrO�sx




$$
,$
zRaw.runN)rZr[r\r]r^r_r`rr+Zurirrd�has_contentrOrXrXrXrYrf�s	
rfc@seZdZdZdd�ZdS)�ReplaceTcCs�t|jtj�s|jd|j��|j�dj|j�}t	j
|�}|jj|j|j|�d}g}x`|D]X}|rzt|t	j
�rz|}q^t|t	j�r�g|d<|j|�q^|jjjd|j|jd�gSq^W|r�||jS|S)NzVInvalid context: the "%s" directive can only be used within a substitution definition.r!Zbackrefsz=Error in "%s" directive: may contain a single paragraph only.)rG)�
isinstancer#r
�SubstitutionDefrJrror1rmr�Element�nested_parserMZ	paragraphZsystem_message�appendr(�reporterr)�children)rPrU�element�node�messages�elemrXrXrYrO�s.



zReplace.runN)rZr[r\rrrOrXrXrXrYrs�srsc@s@eZdZdZdZdZdZejejejd�Z	e
jd�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|jd|j��|jj}d|jkrDd|j	d<d|j	d<d|jkrXd|j	d<d|jkrld|j	d<|j
j|jd�dj�}t
j�}xb|D]Z}ytj|�}Wn8tk
r�}z|jd|t|�f��WYdd}~XnX|t
j|�7}q�W|jS)NzVInvalid context: the "%s" directive can only be used within a substitution definition.r�rr�r�rzInvalid character code: %s
%s)rtr#r
rurJrr(r|r5rq�comment_patternrlr.rrvrZunicode_coderIrrKrz)rPZsubstitution_definitionZcodesr{rZdecodedrJrXrXrYrO.s,








"zUnicode.runN)rZr[r\r]r^r_r`rrard�re�compiler�rOrXrXrXrYrs

rc@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�ytj|jd�}Wn.tk
rB|jd|j|jdf��YnXg}|jr�tj�}|j	j
|j|j|�x|D]}|dj|�qpW|j|j
�n2tjtj||jd�|j�}|jjj|�|j|�|S)Nrz7Invalid class attribute value for "%s" directive: "%s".r )rZ	directive)rrcr.rIrJrrmrrvr#rwrM�extendrz�pendingrZClassAttributerNr(r$Znote_pendingrx)rPZclass_valueZ	node_listZ	containerr|r�rXrXrYrOTs*


z	Class.runN)	rZr[r\r]r^r_r`rrrOrXrXrXrYr�Gsr�c@s0eZdZdZejdejjfd�Z	dd�Z
dS)�RoleTz(%s)\s*(\(\s*(%s)\s*\)\s*)?$�c!Cs�|j|jks|jr$|jd|j��|jd}|jj|�}|sR|jd|j|f��|jd�}|jd�}g}|r�tj	||j
j|j|jj
�\}}|dkr�|jj
jd|tj|j|j�|jd�}||gSntj}y4t|�}|jj|jdd�|j|id	�\}	}
}}WnVtjk
�rV}
z6|j
j
jd
|j|
ftj|j|j�|jd�}||gSd}
~
XnXd|
k�r�ytj|�|
d<WnXtk
�r�}
z:|j
j
jd|jt|
�ftj|j|j�|jd�}||gSd}
~
XnXtj|||
|�}tj||�|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".r�Nz#Unknown interpreted text role "%s".)rG)Zoption_presetszError in "%s" directive:
%s.rz(Invalid argument for "%s" directive:
%s.)rMr)rmrJr�argument_pattern�match�groupr�roler(�languager#ryrrFrNZgeneric_custom_roler
Zparse_directive_blockr
ZMarkupErrorrrcrIrZ
CustomRoleZregister_local_role)rP�argsr�Z
new_role_nameZbase_role_namer}Z	base_rolerJZconverted_roler.r5rmrMZdetailr�rXrXrYrOtsZ






zRole.runN)rZr[r\rrr�r�r
ZInlinerZ
simplenamer�rOrXrXrXrYr�msr�c@s eZdZdZdZdZdd�ZdS)�DefaultRolez&Set the default interpreted text role.rFcCs�|jsdtjkrtjd=gS|jd}tj||jj|j|jj�\}}|dkr||jjj	d|t
j|j|j�|jd�}||gS|tjd<|S)Nrrz#Unknown interpreted text role "%s".)rG)
r.rZ_rolesr�r(r�r)r#ryrJrrFrN)rPZ	role_namer�r}rJrXrXrYrO�s




zDefaultRole.runN)rZr[r\r]r_r`rOrXrXrXrYr��sr�c@s eZdZdZdZdZdd�ZdS)�TitlerrTcCs|jd|jjd<gS)Nr�title)r.r(r$)rPrXrXrYrO�sz	Title.runN)rZr[r\r^r_r`rOrXrXrXrYr��sr�c@seZdZdZdd�ZdS)�DateTcCs�t|jtj�s|jd|j��dj|j�p,d}tj	d
krny|j
tpDd�}Wn"tk
rl|j
dt��YnXtj|�}tj	dkr�y|jtp�d�}Wn6tk
r�|jtp�dd�}|j
d	|tf��YnXtj|�gS)NzVInvalid context: the "%s" directive can only be used within a substitution definition.r!z%Y-%m-%dr�rzutf-8z;Cannot encode date format string with locale encoding "%s".�replacez-Error decoding "%s"with locale encoding "%s".)r�r)r�r)rtr#r
rurJrr1rm�sys�version_info�encoderr=r'�timeZstrftime�decode�UnicodeDecodeErrorrrK)rPZ
format_strrUrXrXrYrO�s(



zDate.runN)rZr[r\rrrOrXrXrXrYr��sr�c@s.eZdZdZdZdZdejiZdZ	dd�Z
dS)�
TestDirectivez3This directive is useful only for testing purposes.rTZoptioncCsl|jrBdj|j�}|jjjd|j|j|jftj	||�|j
d�}n$|jjjd|j|j|jf|j
d�}|gS)Nr!zBDirective processed. Type="%s", arguments=%r, options=%r, content:)rGzGDirective processed. Type="%s", arguments=%r, options=%r, content: None)rmr1r(ry�inforr.r5rrFr))rPrUr�rXrXrYrOs
zTestDirective.runN)rZr[r\r]r_r`rrbrdrrrOrXrXrXrYr��s
r�)'r]Z
__docformat__r�Zos.pathr*r�r�ZdocutilsrrrrZdocutils.utils.error_reportingrrrZdocutils.parsers.rstr	r
rrr
Z$docutils.parsers.rst.directives.bodyrrZdocutils.parsers.rst.rolesrZdocutils.transformsrrrfrsrr�r�r�r�r�r�rXrXrXrY�<module>s0Z ,&=.