shell bypass 403

Cubjrnet7 Shell


name : doctestcompare.cpython-39.opt-1.pyc
a

��a�G�@sbdZddlmZddlZddlZddlZzddlmZWne	yVddl
mZYn0gd�ZzeZ
Wney�eefZ
Yn0ejddkZe�d�Ze�d�Ze�d	�ZejZd
d�Zdd
�Zejddd�Zdd�Ze�d�Ze�d�ZGdd�de�Z Gdd�de �Z!d$dd�Z"d%dd�Z#Gdd�de$�Z%dd �Z&d!d"iZ'e(d#k�r^ddlZe�)�dS)&a�
lxml-based doctest output comparison.

Note: normally, you should just import the `lxml.usedoctest` and
`lxml.html.usedoctest` modules from within a doctest, instead of this
one::

    >>> import lxml.usedoctest # for XML output

    >>> import lxml.html.usedoctest # for HTML output

To use this module directly, you must call ``lxmldoctest.install()``,
which will cause doctest to use this in all subsequent calls.

This changes the way output is checked and comparisons are made for
XML or HTML-like content.

XML or HTML content is noticed because the example starts with ``<``
(it's HTML if it starts with ``<html``).  You can also use the
``PARSE_HTML`` and ``PARSE_XML`` flags to force parsing.

Some rough wildcard-like things are allowed.  Whitespace is generally
ignored (except in attributes).  In text (attributes and text in the
body) you can use ``...`` as a wildcard.  In an example it also
matches any trailing tags in the element, though it does not match
leading tags.  You may create a tag ``<any>`` or include an ``any``
attribute in the tag.  An ``any`` tag matches any tag, while the
attribute matches any and all attributes.

When a match fails, the reformatted example and gotten text is
displayed (indented), and a rough diff-like output is given.  Anything
marked with ``+`` is in the output but wasn't supposed to be, and
similarly ``-`` means its in the example but wasn't in the output.

You can disable parsing on one line with ``# doctest:+NOPARSE_MARKUP``
�)�etreeN)�escape)�
PARSE_HTML�	PARSE_XML�NOPARSE_MARKUP�LXMLOutputChecker�LHTMLOutputChecker�install�temp_install�rrrcCs|durdS|��SdS�N)�strip��v�r�9/usr/lib64/python3.9/site-packages/lxml/doctestcompare.pyr
?sr
cCst�d|�S)N� )�_norm_whitespace_re�subrrrr�norm_whitespaceEsrFT)ZrecoverZremove_blank_textcCst�|t�Sr)rZ
fromstring�_html_parser��htmlrrr�html_fromstringJsrz^<[^>]+ (at|object) z[ \t\n][ \t\n]+c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zd'dd�Zd(dd�Z
d)dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd*d$d%�Zd&S)+r)
ZparamZimgZarea�brZbasefont�input�base�meta�link�colcCstjSr)r�XML��selfrrr�get_default_parserWsz$LXMLOutputChecker.get_default_parserc	Cs�t|dd�}|dur |j}|}ntj}|�|||�}|sF|||||�Sz||�}WntjyhYdS0z||�}Wntjy�YdS0|�||�S)N�_temp_override_selfF)�getattr�_temp_call_super_check_output�
OutputChecker�check_output�
get_parserr�XMLSyntaxError�compare_docs)	r"�want�got�optionflagsZalt_selfZsuper_method�parser�want_doc�got_docrrrr(Zs&�zLXMLOutputChecker.check_outputcCstd}t|@rdSt|@rt}nRt|@r.tj}nB|�����d�rT|���d�rTt}n|�	|�rp|�	|�rp|�
�}|S)Nz<html)rrrrrr r
�lower�
startswith�_looks_like_markupr#)r"r,r-r.r/rrrr)os �
�zLXMLOutputChecker.get_parsercCs|��}|�d�ot�|�S)N�<)r
r3�_repr_re�search)r"�srrrr4s

�z$LXMLOutputChecker._looks_like_markupc
Cs|�|j|j�sdS|�|j|jd�s*dS|�|j|jd�s@dSd|jvr�t|j���}t|j���}||krrdS|D]$}|�|j||j|d�svdSqv|jdks�t|��rt	|�}t	|�}|s�|�r|r�|s�dS|�
d�}|�
d�}	|�||	�s�dS|s�|jdkr��qq�dS)NFT�anyz...r)�tag_compare�tag�text_compare�text�tail�attrib�sorted�keys�len�list�popr+)
r"r,r-Z	want_keysZgot_keys�key�
want_children�got_childrenZ
want_firstZ	got_firstrrrr+�s6



zLXMLOutputChecker.compare_docscCs^|pd}|pd}|r,t|���}t|���}dt�|�}|�dd�}t�||�rVdSdSdS)N�z^%s$z\.\.\.z.*TF)rr
�rer�replacer7)r"r,r-r
rrrr<�szLXMLOutputChecker.text_comparecCsj|dkrdSt|t�r t|t�s(||kS|p.d}|p6d}|�d�r^|�d�d|�d�dkS||kSdS)Nr9TrHz{...}�}���)�
isinstance�_basestringr3�split)r"r,r-rrrr:�s
�
zLXMLOutputChecker.tag_comparec
Cs|j}|�|||�}g}|dur�z||�}Wn.tjyZt��d}|�d|�Yn0z||�}	Wn.tjy�t��d}|�d|�Yn0|dus�|r�t�||||�}
|r�|�|
�d�	|�S|
S|t
u}d|�||d�d|�|	|d�d|�||	|d�g}d�	|�S)	N�zIn example: %szIn actual output: %s�
z	Expected:�zGot:zDiff:)
r,r)rr*�sys�exc_info�appendr'�output_difference�joinr�
format_doc�collect_diff)
r"Zexampler-r.r,r/�errorsr0�er1�valuerZ
diff_partsrrrrV�s>�

�z#LXMLOutputChecker.output_differenceTcCs.|sdS|j|jvrdS|js&t|�r*dSdS)NFT)r;�
empty_tagsr=rB)r"�elrrrr�html_empty_tag�sz LXMLOutputChecker.html_empty_tagrHc	Cs�g}t|�s�|�d|�|�|�|�|�|��|�||�slt|j�r\|�|�|j��|�|�|��t|j�r�|�|�|j��|�d�d�	|�S|�d|�|�|�|�|�|��|�||��s^|�d�t|j��r|�d|�|�|�|j��|�d�|D]}|�|�
|||d���q|�d|�|�|�|��|�d�t|j��r�|�d|�|�|�|j��|�d�d�	|�S)NrrQrHrR)rBrU�
format_tagr_r
r=�format_text�format_end_tagr>rWrX)r"�docr�indent�prefix�partsr^rrrrX�s@









zLXMLOutputChecker.format_doccCs"|durdS|r|��}t|d�S)NrHrP)r
�html_escape)r"r=r
rrrra	s
zLXMLOutputChecker.format_textc	Cshg}t|tj�rdSt|j���D]"\}}|�d||�|d�f�q"|sTd|jSd|jd�	|�fS)Nz<!--�%s="%s"F�<%s>�<%s %s>r)
rMr�CommentBaser@r?�itemsrUrar;rW)r"r^�attrs�namer\rrrr`s
zLXMLOutputChecker.format_tagcCst|tj�rdSd|jS)Nz-->�</%s>)rMrrkr;)r"r^rrrrbsz LXMLOutputChecker.format_end_tagc	Csg}t|�s�t|�s�|�d|�|�|�||��|�||�sh|�|�|j|j��|�|�||��|�|�|j|j��|�d�d�|�S|�d|�|�|�||��|�d�t	|j�s�t	|j�r�|�d|�|�|�|j|j��|�d�t
|�}t
|�}|�s|�r�|�sD|�|�|�d�||dd���q|�sn|�|�|�d�||dd���q|�|�
|�d�|�d�||d���q|�d|�|�|�||��|�d�t	|j��s�t	|j��r|�d|�|�|�|j|j��|�d�d�|�S)NrrQrHrrR�+�-)rBrU�collect_diff_tagr_�collect_diff_textr=�collect_diff_end_tagr>rWr
rCrXrDrY)r"r,r-rrdrfrFrGrrrrY!sJ



  �


zLXMLOutputChecker.collect_diffc		Cs*|�|j|j�s"d|j|jf}n|j}g}|jdkp>d|jv}t|j���D]p\}}||jvr�|s�|�d||�|d�f�qN||jvr�|�|j||d�}n|�|d�}|�d||f�qN|�st|j���D].\}}||jvr�q�|�d||�|d�f�q�|�rd|d�|�f}nd	|}|S)
N�%s (got: %s)r9z+%s="%s"Frhz-%s="%s"rjrri)	r:r;r?r@rlrUrarsrW)	r"r,r-r;rmr9rnr\r=rrrrrGs*

z"LXMLOutputChecker.collect_diff_tagcCs,|j|jkrd|j|jf}n|j}d|S)Nruro)r;)r"r,r-r;rrrrtbsz&LXMLOutputChecker.collect_diff_end_tagcCs:|�|||�r"|sdS|�||�Sd||f}|�||�S)NrHru)r<ra)r"r,r-r
r=rrrrsisz#LXMLOutputChecker.collect_diff_textN)T)rH)T)T)�__name__�
__module__�__qualname__r]r#r(r)r4r+r<r:rVr_rXrar`rbrYrrrtrsrrrrrQs$
 


#
&rc@seZdZdd�ZdS)rcCstSr)rr!rrrr#rsz%LHTMLOutputChecker.get_default_parserN)rvrwrxr#rrrrrqsrcCs|rtt_ntt_dS)z�
    Install doctestcompare for all future doctests.

    If html is true, then by default the HTML parser will be used;
    otherwise the XML parser is used.
    N)r�doctestr'rrrrrr	usr	c	Csz|r
t}nt}t�}|jd}|�}|j}||_trJ|jdj}|jj}n|jdj}|jj}t	t
_	t||||||�dS)z�
    Use this *inside* a doctest to enable this checker for this
    doctest only.

    If html is true, then by default the HTML parser will be used;
    otherwise the XML parser is used.
    r"�checkN)rr�_find_doctest_frame�f_localsZ_checker�_IS_PYTHON_3�__func__r(Zim_funcrry�_RestoreChecker)	r�
del_moduleZChecker�frame�dt_self�checker�old_checker�
check_funcZchecker_check_funcrrrr
�s$


�r
c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)rcCsD||_||_|j|j_||j_||_||_||_|��|�	�dSr)
r�r��
call_superr&r$r��
clone_funcr��
install_clone�install_dt_self)r"r�r�Znew_checkerr�r�r�rrr�__init__�s
z_RestoreChecker.__init__cCsJtr&|jj|_|jj|_|jj|j_n |jj|_|jj|_|jj|j_dSr)r}r��__code__�	func_code�__globals__Zfunc_globalsr�r!rrrr��s



z_RestoreChecker.install_clonecCstr|j|j_n
|j|j_dSr)r}r�r�r�r!rrr�uninstall_clone�sz_RestoreChecker.uninstall_clonecCs|jj|_||j_dSr)r��_DocTestRunner__record_outcome�	prev_funcr!rrrr��s
z_RestoreChecker.install_dt_selfcCs|j|j_dSr)r�r�r�r!rrr�uninstall_dt_self�sz!_RestoreChecker.uninstall_dt_selfcCsL|jrHddl}|j|j=d|jvrH|j�dd�\}}|j|}t||�dS)Nr�.rP)r�rS�modules�rsplit�delattr)r"rS�package�moduleZpackage_modrrr�uninstall_module�s


z _RestoreChecker.uninstall_modulecOs8|��|��|j`|j`|j|i|��}|��|Sr)r�r�r�r$r&r�r�)r"�args�kw�resultrrr�__call__�sz_RestoreChecker.__call__cOs2|��z|j|i|��W|��S|��0dSr)r�r�r�)r"r�r�rrrr��s�z_RestoreChecker.call_superN)rvrwrxr�r�r�r�r�r�r�r�rrrrr�s	rcCs<ddl}|�d�}|r0|j}d|vr(|S|j}qtd��dS)NrrPZBOOMzBCould not find doctest (only use this function *inside* a doctest))rS�	_getframer|�f_back�LookupError)rSr��lrrrr{�s
�r{Zbasicai
    >>> temp_install()
    >>> print """<xml a="1" b="2">stuff</xml>"""
    <xml b="2" a="1">...</xml>
    >>> print """<xml xmlns="http://example.com"><tag   attr="bar"   /></xml>"""
    <xml xmlns="...">
      <tag attr="..." />
    </xml>
    >>> print """<xml>blahblahblah<foo /></xml>""" # doctest: +NOPARSE_MARKUP, +ELLIPSIS
    <xml>...foo /></xml>
    �__main__)F)FN)*�__doc__ZlxmlrrSrIryrrrg�ImportErrorZcgi�__all__Z
basestringrN�	NameError�str�bytes�version_infor}Zregister_optionflagrrrr'r
rZ
HTMLParserrr�compiler6rrrr	r
�objectrr{Z__test__rvZtestmodrrrr�<module>sJ%




"

'6
�


© 2025 Cubjrnet7