- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.227.52.200
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib64/python3.6/site-packages/lxml/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.6/site-packages/lxml/__pycache__/doctestcompare.cpython-36.pyc
3

U�*W�G�@spdZddlmZddlZddlZddlZyddlmZWn e	k
rXddl
mZYnXddddd	d
dgZyeZ
Wnek
r�eefZ
YnXejddkZejd�Zejd�Zejd�ZejZd
d�Zdd�Zejddd�Zdd�Zejd�Zejd�ZGdd�de�Z Gdd	�d	e �Z!d#dd
�Z"d$dd�Z#Gdd�de$�Z%dd�Z&d d!iZ'e(d"k�rlddlZej)�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�cCs|dkrdS|j�SdS)N)�strip)�v�r�&/usr/lib64/python3.6/doctestcompare.pyr?srcCstjd|�S)N� )�_norm_whitespace_re�sub)r
rrr�norm_whitespaceEsrFT)ZrecoverZremove_blank_textcCstj|t�S)N)rZ
fromstring�_html_parser)�htmlrrr�html_fromstringJsrz^<[^>]+ (at|object) z[ \t\n][ \t\n]+c
@s�eZdZd0Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zd1dd�Zd2dd �Z
d3d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd4d-d.�Zd/S)5r�param�img�area�br�basefont�input�base�meta�link�colcCstjS)N)r�XML)�selfrrr�get_default_parserWsz$LXMLOutputChecker.get_default_parserc	Cs�t|dd�}|dk	r |j}|}ntj}|j|||�}|sF|||||�Sy||�}Wntjk
rhdSXy||�}Wntjk
r�dSX|j||�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|j�j�jd�rT|j�jd�rTt}n|j	|�rp|j	|�rp|j
�}|S)Nz<html)rrrrrr!r�lower�
startswith�_looks_like_markupr#)r"r,r-r.r/rrrr)os

zLXMLOutputChecker.get_parsercCs|j�}|jd�otj|�S)N�<)rr3�_repr_re�search)r"�srrrr4s
z$LXMLOutputChecker._looks_like_markupc
Cs|j|j|j�sdS|j|j|jd�s*dS|j|j|jd�s@dSd|jkr�t|jj��}t|jj��}||krrdSx*|D]"}|j|j||j|d�sxdSqxW|jdks�t|��rt	|�}t	|�}xV|s�|�r|s�|r�dS|j
d�}|j
d�}	|j||	��sdS|r�|jdkr�Pq�WdS)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|�j�}t|�j�}dtj|�}|jdd�}tj||�rVdSdSdS)N�z^%s$z\.\.\.z.*TF)rr�rer�replacer7)r"r,r-rrrrr<�szLXMLOutputChecker.text_comparecCsn|dkrdSt|t�s$t|t�r,||kS|p2d}|p:d}|jd�rb|jd�d|jd�dkS||kSdS)	Nr9TrHz{...}�}����rM)�
isinstance�_basestringr3�split)r"r,r-rrrr:�s
zLXMLOutputChecker.tag_comparec
CsF|j}|j|||�}g}|dk	r�y||�}Wn0tjk
r\tj�d}|jd|�YnXy||�}	Wn0tjk
r�tj�d}|jd|�YnX|dks�|r�tj||||�}
|r�|j|
�dj	|�S|
S|t
k}g}|jd�|j|j||d��|jd�|j|j|	|d��|jd�|j|j||	|d��dj	|�S)	NrLzIn 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|jkrdS|js&t|�r*dSdS)NFT)r;�
empty_tagsr=rB)r"�elrrrr�html_empty_tag�sz LXMLOutputChecker.html_empty_tagrHcCs�g}t|�s�|jd|�|j|�|j|j|��|j||�slt|j�r\|j|j|j��|j|j|��t|j�r�|j|j|j��|jd�dj	|�S|jd|�|j|�|j|j|��|j||��sb|jd�t|j��r|jd|�|j|j|j��|jd�x&|D]}|j|j
|||d���qW|jd|�|j|j|��|jd�t|j��r�|jd|�|j|j|j��|jd�dj	|�S)NrrQrHrR)rBrU�
format_tagr_rr=�format_text�format_end_tagr>rWrX)r"�docr�indent�prefix�partsr^rrrrX�s@










zLXMLOutputChecker.format_doccCs"|dkrdS|r|j�}t|d�S)NrHrL)r�html_escape)r"r=rrrrra
s
zLXMLOutputChecker.format_textcCslg}t|tj�rdSx4t|jj��D]"\}}|jd||j|d�f�q$W|sXd|jSd|jdj	|�fS)Nz<!--z%s="%s"Fz<%s>z<%s %s>r)
rNr�CommentBaser@r?�itemsrUrar;rW)r"r^�attrs�namer\rrrr`s
zLXMLOutputChecker.format_tagcCst|tj�rdSd|jS)Nz-->z</%s>)rNrrhr;)r"r^rrrrbsz LXMLOutputChecker.format_end_tagcCsg}t|�r�t|�r�|jd|�|j|j||��|j||�sl|j|j|j|j��|j|j||��|j|j|j|j��|jd�dj|�S|jd|�|j|j||��|jd�t	|j�s�t	|j��r|jd|�|j|j|j|j��|jd�t
|�}t
|�}x�|�s"|�r�|�sL|j|j|jd�||dd���q|�sv|j|j|jd�||dd���q|j|j
|jd�|jd�||d���qW|jd|�|j|j||��|jd�t	|j��s�t	|j��r|jd|�|j|j|j|j��|jd�dj|�S)NrrQrHrrR�+�-)rBrU�collect_diff_tagr_�collect_diff_textr=�collect_diff_end_tagr>rWrrCrXrDrY)r"r,r-rrdrfrFrGrrrrY"sH



  $

zLXMLOutputChecker.collect_diffc	Cs4|j|j|j�s"d|j|jf}n|j}g}|jdkp>d|jk}x�t|jj��D]r\}}||jkr�|r�|jd||j|d�f�qP||jkr�|j|j||d�}n|j|d�}|jd||f�qPW|�sx@t|jj��D].\}}||jkr�q�|jd||j|d�f�q�W|�r(d|dj|�f}nd	|}|S)
Nz%s (got: %s)r9z+%s="%s"Fz%s="%s"z-%s="%s"z<%s %s>rz<%s>)	r:r;r?r@rirUrarorW)	r"r,r-r;rjr9rkr\r=rrrrnHs*

z"LXMLOutputChecker.collect_diff_tagcCs,|j|jkrd|j|jf}n|j}d|S)Nz%s (got: %s)z</%s>)r;)r"r,r-r;rrrrpcsz&LXMLOutputChecker.collect_diff_end_tagcCs:|j|||�r"|sdS|j||�Sd||f}|j||�S)NrHz%s (got: %s))r<ra)r"r,r-rr=rrrrojsz#LXMLOutputChecker.collect_diff_textN)
rrrrrrrrrr )T)rH)T)T)�__name__�
__module__�__qualname__r]r#r(r)r4r+r<r:rVr_rXrar`rbrYrnrprorrrrrQs&
!


#
&c@seZdZdd�ZdS)rcCstS)N)r)r"rrrr#ssz%LHTMLOutputChecker.get_default_parserN)rqrrrsr#rrrrrrscCs|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'r)rrrrr	vsc	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"ZcheckN)rr�_find_doctest_frame�f_localsZ_checker�_IS_PYTHON_3�__func__r(Zim_funcrrt�_RestoreChecker)	r�
del_moduleZChecker�frame�dt_self�checker�old_checker�
check_funcZchecker_check_funcrrrr
�s"


c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)rycCsD||_||_|j|j_||j_||_||_||_|j�|j	�dS)N)
r|r}�
call_superr&r$r�
clone_funcrz�
install_clone�install_dt_self)r"r|r~Znew_checkerrr�rzrrr�__init__�s
z_RestoreChecker.__init__cCsJtr&|jj|_|jj|_|jj|j_n |jj|_|jj|_|jj|j_dS)N)rwr�__code__�	func_code�__globals__Zfunc_globalsr�)r"rrrr��s



z_RestoreChecker.install_clonecCstr|j|j_n
|j|j_dS)N)rwr�rr�)r"rrr�uninstall_clone�sz_RestoreChecker.uninstall_clonecCs|jj|_||j_dS)N)r|�_DocTestRunner__record_outcome�	prev_func)r"rrrr��s
z_RestoreChecker.install_dt_selfcCs|j|j_dS)N)r�r|r�)r"rrr�uninstall_dt_self�sz!_RestoreChecker.uninstall_dt_selfcCsL|jrHddl}|j|j=d|jkrH|jjdd�\}}|j|}t||�dS)Nr�.rL)rzrS�modules�rsplit�delattr)r"rS�package�moduleZpackage_modrrr�uninstall_module�s


z _RestoreChecker.uninstall_modulecOs4|j�|j�|j`|j`|j||�}|j�|S)N)r�r�r}r$r&r�r�)r"�args�kw�resultrrr�__call__�sz_RestoreChecker.__call__c
Os$|j�z|j||�S|j�XdS)N)r�rr�)r"r�r�rrrr��sz_RestoreChecker.call_superN)rqrrrsr�r�r�r�r�r�r�r�rrrrry�s	rycCs@ddl}|jd�}x |r2|j}d|kr*|S|j}qWtd��dS)NrrLZBOOMzBCould not find doctest (only use this function *inside* a doctest))rS�	_getframerv�f_back�LookupError)rSr{�lrrrru�s

ruZbasicai
    >>> 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__ZlxmlrrSrIrtrrrg�ImportErrorZcgi�__all__Z
basestringrO�	NameError�str�bytes�version_inforwZregister_optionflagrrrr'rrZ
HTMLParserrr�compiler6rrrr	r
�objectryruZ__test__rqZtestmodrrrr�<module>$sL





#

'6




Youez - 2016 - github.com/yon3zu
LinuXploit