403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.221.207.166
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/bs4/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/bs4/__pycache__/diagnose.cpython-37.opt-1.pyc
B

�.�`��@sdZdZddlZddlmZddlmZddlZddlmZm	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"k�reej� ��dS))z=Diagnostic functions, mainly for use when doing tech support.ZMIT�N)�StringIO)�
HTMLParser)�
BeautifulSoup�__version__)�builder_registrycCs<tdt�tdtj�dddg}x>|D]6}x0tjD]}||jkr6Pq6W|�|�td|�q*Wd|kr�|�ddg�y*dd	l	m
}td
d�tt
|j���Wn*tk
r�}ztd�Wd
d
}~XYnXd|k�r"ydd
l}td|j�Wn,tk
�r }ztd�Wd
d
}~XYnXt|d��r8|��}nhtj�|��rptd|�t|��}|��}Wd
QRXn0|�d��s�|�d��r�td|�td�d
St�x�|D]�}td|�d}	yt||�}
d}	Wn8tk
�r
}ztd|�t��Wd
d
}~XYnX|	�r*td|�t|
���td��q�Wd
S)z/Diagnostic suite for isolating common problems.z'Diagnostic running on Beautiful Soup %szPython version %szhtml.parser�html5lib�lxmlz;I noticed that %s is not installed. Installing it may help.Zxmlr)�etreezFound lxml version %s�.z.lxml is not installed or couldn't be imported.NzFound html5lib version %sz2html5lib is not installed or couldn't be imported.�readz7"%s" looks like a filename. Reading data from the file.zhttp: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.z#Trying to parse your markup with %sFTz%s could not parse the markup.z#Here's what %s did with the markup:zP--------------------------------------------------------------------------------)�printr�sys�versionrZbuildersZfeatures�remove�appendrr	�join�map�strZLXML_VERSION�ImportErrorr�hasattrr�os�path�exists�open�
startswithr�	Exception�	traceback�	print_excZprettify)�dataZ
basic_parsers�nameZbuilderr	�er�fp�parser�success�soup�r%�=/opt/alt/python37/lib/python3.7/site-packages/bs4/diagnose.py�diagnosesd








r'TcKsNddlm}x<|jt|�fd|i|��D]\}}td||j|jf�q(WdS)z�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.
    r)r	�htmlz%s, %4s, %sN)rr	Z	iterparserr�tag�text)rr(�kwargsr	�event�elementr%r%r&�
lxml_traceTs$r.c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�AnnouncingParserz?Announces HTMLParser parse events, without doing anything else.cCst|�dS)N)r)�self�sr%r%r&�_paszAnnouncingParser._pcCs|�d|�dS)Nz%s START)r2)r0rZattrsr%r%r&�handle_starttagdsz AnnouncingParser.handle_starttagcCs|�d|�dS)Nz%s END)r2)r0rr%r%r&�
handle_endtaggszAnnouncingParser.handle_endtagcCs|�d|�dS)Nz%s DATA)r2)r0rr%r%r&�handle_datajszAnnouncingParser.handle_datacCs|�d|�dS)Nz
%s CHARREF)r2)r0rr%r%r&�handle_charrefmszAnnouncingParser.handle_charrefcCs|�d|�dS)Nz%s ENTITYREF)r2)r0rr%r%r&�handle_entityrefpsz!AnnouncingParser.handle_entityrefcCs|�d|�dS)Nz
%s COMMENT)r2)r0rr%r%r&�handle_commentsszAnnouncingParser.handle_commentcCs|�d|�dS)Nz%s DECL)r2)r0rr%r%r&�handle_declvszAnnouncingParser.handle_declcCs|�d|�dS)Nz%s UNKNOWN-DECL)r2)r0rr%r%r&�unknown_declyszAnnouncingParser.unknown_declcCs|�d|�dS)Nz%s PI)r2)r0rr%r%r&�	handle_pi|szAnnouncingParser.handle_piN)�__name__�
__module__�__qualname__�__doc__r2r3r4r5r6r7r8r9r:r;r%r%r%r&r/^sr/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.
    N)r/Zfeed)rr"r%r%r&�htmlparser_tracesr@ZaeiouZbcdfghjklmnpqrstvwxyz�cCs>d}x4t|�D](}|ddkr$t}nt}|t�|�7}qW|S)z#Generate a random word-like string.��r)�range�_consonants�_vowels�random�choice)�lengthr1�i�tr%r%r&�rword�srL�cCsd�dd�t|�D��S)z'Generate a random sentence-like string.� css|]}tt�dd��VqdS)rM�	N)rLrG�randint)�.0rJr%r%r&�	<genexpr>�szrsentence.<locals>.<genexpr>)rrD)rIr%r%r&�	rsentence�srS��cCs�dddddddg}g}x~t|�D]r}t�dd	�}|dkrRt�|�}|�d
|�q |dkrr|�tt�dd���q |d
kr t�|�}|�d|�q Wdd�|�dS)z+Randomly generate an invalid HTML document.�pZdiv�spanrJ�b�script�tabler�z<%s>�rMrCz</%s>z<html>�
z</html>)rDrGrPrHrrSr)�num_elementsZ	tag_names�elementsrJrHZtag_namer%r%r&�rdoc�s

r_順c
Cs(tdt�t|�}tdt|��x�dddgddgD]z}d}y"t��}t||�}t��}d}Wn6tk
r�}ztd	|�t��Wd
d
}~XYnX|r6td|||f�q6Wd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).rr(rzhtml.parserFTz%s could not parse the markup.Nz"BS4+%s parsed the markup in %.2fs.r)r	z$Raw lxml parsed the markup in %.2fs.z(Raw html5lib parsed the markup in %.2fs.)rrr_�len�timerrrrrr	ZHTMLrr�parse)
r]rr"r#�ar$rWr r	rr%r%r&�benchmark_parsers�s4


rercCsXt��}|j}t|�}tt||d�}t�d|||�t�	|�}|�
d�|�dd�dS)N)�bs4rr"zbs4.BeautifulSoup(data, parser)Z
cumulativez
_html5lib|bs4�2)�tempfileZNamedTemporaryFilerr_�dictrf�cProfileZrunctx�pstatsZStatsZ
sort_statsZprint_stats)r]r"Z
filehandle�filenamer�varsZstatsr%r%r&�profile�s

rn�__main__)T)rA)rM)rT)r`)r`r)!r?Z__license__rj�iorZhtml.parserrrfrrZbs4.builderrrrkrGrhrbrr
r'r.r/r@rFrErLrSr_rernr<�stdinrr%r%r%r&�<module>s8=

!	



 



Youez - 2016 - github.com/yon3zu
LinuXploit