Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
#6]„ ã @ 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"k�reejj ƒ ƒ dS ))z=Diagnostic functions, mainly for use when doing tech support.ZMITé N)ÚStringIO)Ú
HTMLParser)Ú
BeautifulSoupÚ__version__)Úbuilder_registryc ; C sX t dt ƒ t dtj ƒ dddg}x>|D ]6}x0tjD ]}||jkr6P q6W |j|ƒ t d| ƒ q*W d|krÌ|jdƒ y*dd l m
} t d
djtt
|jƒƒ ƒ W n* tk
rÊ } zt dƒ W Y d
d
}~X nX d|k�rydd
l}t d|j ƒ W n, tk
�r } zt dƒ W Y d
d
}~X nX t| dƒ�r4| jƒ } nˆ| jdƒ�sL| jdƒ�rdt d| ƒ t dƒ d
S y:tjj| ƒ�rœt d| ƒ t| ƒ�}|jƒ } W d
Q R X W n tk
�r´ Y nX t ƒ x–|D ]Ž}t d| ƒ d} yt| |d�}
d} W n8 tk
�r" } zt d| ƒ tjƒ W Y d
d
}~X nX | �rBt d| ƒ t |
jƒ ƒ t dd ƒ �qÂW d
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.zlxml-xmlr )Ú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.Ú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)ÚfeaturesTz%s could not parse the markup.z#Here's what %s did with the markup:ú-éP )Úprintr ÚsysÚversionr Zbuildersr ÚremoveÚappendr r ÚjoinÚmapÚstrZLXML_VERSIONÚImportErrorr Úhasattrr Ú
startswithÚosÚpathÚexistsÚopenÚ
ValueErrorr Ú ExceptionÚ tracebackÚ print_excZprettify)ÚdataZ
basic_parsersÚnameZbuilderr Úer ÚfpÚparserÚsuccessÚsoup© r) ú/usr/lib/python3.6/diagnose.pyÚdiagnose sj
r+ Tc K sN ddl m} x<|jt| ƒfd|i|—ŽD ]\}}td||j|jf ƒ q(W dS )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)r r Z iterparser r ÚtagÚtext)r" r, Úkwargsr ZeventÚelementr) r) r* Ú
lxml_traceZ s $r1 c @ s` e Zd ZdZdd„ Zdd„ Zdd„ Zdd „ Zd
d„ Zdd
„ Z dd„ Z
dd„ Zdd„ Zdd„ Z
dS )ÚAnnouncingParserz?Announces HTMLParser parse events, without doing anything else.c C s t |ƒ d S )N)r )ÚselfÚsr) r) r* Ú_pg s zAnnouncingParser._pc C s | j d| ƒ d S )Nz%s START)r5 )r3 r# Zattrsr) r) r* Úhandle_starttagj s z AnnouncingParser.handle_starttagc C s | j d| ƒ d S )Nz%s END)r5 )r3 r# r) r) r* Ú
handle_endtagm s zAnnouncingParser.handle_endtagc C s | j d| ƒ d S )Nz%s DATA)r5 )r3 r" r) r) r* Úhandle_datap s zAnnouncingParser.handle_datac C s | j d| ƒ d S )Nz
%s CHARREF)r5 )r3 r# r) r) r* Úhandle_charrefs s zAnnouncingParser.handle_charrefc C s | j d| ƒ d S )Nz%s ENTITYREF)r5 )r3 r# r) r) r* Úhandle_entityrefv s z!AnnouncingParser.handle_entityrefc C s | j d| ƒ d S )Nz
%s COMMENT)r5 )r3 r" r) r) r* Úhandle_commenty s zAnnouncingParser.handle_commentc C s | j d| ƒ d S )Nz%s DECL)r5 )r3 r" r) r) r* Úhandle_decl| s zAnnouncingParser.handle_declc C s | j d| ƒ d S )Nz%s UNKNOWN-DECL)r5 )r3 r" r) r) r* Úunknown_decl s zAnnouncingParser.unknown_declc C s | j d| ƒ d S )Nz%s PI)r5 )r3 r" r) r) r* Ú handle_pi‚ s zAnnouncingParser.handle_piN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r5 r6 r7 r8 r9 r: r; r<