| 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 : |
o
��7aK � @ s d Z dZddlZddlmZ ddlmZ ddlZddlmZm Z ddl
mZ ddlZddl
Z
ddlZddlZddlZddlZddlZddlZdd � Zd#dd�ZG d
d� de�Zdd� ZdZdZd$dd�Zd%dd�Zd&dd�Zd'dd�Zd(d d!�Zed"kr�eej� � � dS dS ))z=Diagnostic functions, mainly for use when doing tech support.�MIT� N)�StringIO)�
HTMLParser)�
BeautifulSoup�__version__)�builder_registryc C sR t dt � t dtj � g d�}|D ]}tjD ] }||jv r! nq|�|� t d| � qd|v rc|�d� zddl m
} t d d
�tt
|j�� � W n tyb } z
t d� W Y d}~nd}~ww d
|v r�z
ddl}t d|j � W n ty� } z
t d� W Y d}~nd}~ww t| d�r�| �� } nJ| �d�s�| �d�r�t d| � t d� dS z&tj�| �r�t d| � t| ��}|�� } W d � n1 s�w Y W n ty� Y nw t d� |D ]E}t d| � d} z
t| |d�}
d} W n t�y } zt d| � t�� W Y d}~nd}~ww | �r"t d| � t |
�� � t d� q�dS )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�diagnose s�
�
���
������
�����
�r3 Tc K sJ ddl m} |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.
r r �htmlz%s, %4s, %sN)r
r � iterparser r �tag�text)r( r4 �kwargsr �event�elementr1 r1 r2 �
lxml_trace] s "�r; c @ s` e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� 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`.
c C s t |� d S )N)r )�self�sr1 r1 r2 �_pu s zAnnouncingParser._pc C � | � d| � d S )Nz%s START�r? )r= r* �attrsr1 r1 r2 �handle_starttagx � z AnnouncingParser.handle_starttagc C r@ )Nz%s ENDrA �r= r* r1 r1 r2 �
handle_endtag{ rD zAnnouncingParser.handle_endtagc C r@ )Nz%s DATArA �r= r( r1 r1 r2 �handle_data~ rD zAnnouncingParser.handle_datac C r@ )Nz
%s CHARREFrA rE r1 r1 r2 �handle_charref� rD zAnnouncingParser.handle_charrefc C r@ )Nz%s ENTITYREFrA rE r1 r1 r2 �handle_entityref� rD z!AnnouncingParser.handle_entityrefc C r@ )Nz
%s COMMENTrA rG r1 r1 r2 �handle_comment� rD zAnnouncingParser.handle_commentc C r@ )Nz%s DECLrA rG r1 r1 r2 �handle_decl� rD zAnnouncingParser.handle_declc C r@ )Nz%s UNKNOWN-DECLrA rG r1 r1 r2 �unknown_decl� rD zAnnouncingParser.unknown_declc C r@ )Nz%s PIrA rG r1 r1 r2 � handle_pi� rD zAnnouncingParser.handle_piN)�__name__�
__module__�__qualname__�__doc__r? rC rF rH rI rJ rK rL rM rN r1 r1 r1 r2 r<