Your IP : 52.15.176.138
�
aOfc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej ej
gZWnek
r�ej gZnXd�Z
id�Zid�Zid�Zd�Zdejfd ��YZd
ejfd��YZdejfd
��YZdd�ZdS(snA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
i����NcCs3x,|j�D]\}}|j||�}q
W|S(s2Replace substrings of a string using a dictionary.(titemstreplace(tstdtkeytvalue((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt__dict_replacescCsR|jdd�}|jdd�}|jdd�}|rNt||�}n|S(s�Escape &, <, and > in a string of data.
You can escape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
t&s&t>s>t<s<(RR(tdatatentities((s(/usr/lib64/python2.7/xml/sax/saxutils.pytescapes cCsL|jdd�}|jdd�}|r<t||�}n|jdd�S(s
Unescape &, <, and > in a string of data.
You can unescape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
s<R s>Rs&R(RR(R
R((s(/usr/lib64/python2.7/xml/sax/saxutils.pytunescape's
cCs�|j�}|jidd6dd6dd6�t||�}d|kr{d|krnd |jdd
�}q�d|}n
d |}|S(s�Escape and quote an attribute value.
Escape &, <, and > in a string of data, then quote it for use as
an attribute value. The " character will be escaped as well, if
necessary.
You can escape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
s s
s s
s	s t"t's"%s"s"s'%s'(tcopytupdateRR(R
R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt quoteattr5s"
cCs�|dkr$ddl}|j}nt|tj�rTtj|�}d�|_nTtj�}d�|_|j |_ y|j
|_
|j|_Wntk
r�nXt
|d|dddd�S( Ni����cSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<lambda>VtcSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines
(Rtsyststdoutt
isinstancetiot RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"
R'cBseZd�ZRS(cCs$tt|�j|�|j�dS(N(tsuperR'R#tflush(tselfR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t
__module__R#(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR'jstXMLGeneratorcBs�eZddd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�Zd
�ZRS(s
iso-8859-1cCsitjj|�t||�}|j|_|j|_ig|_|jd|_ g|_
||_dS(Ni����(thandlertContentHandlert__init__R*R#t_writeR,t_flusht_ns_contextst_current_contextt_undeclared_ns_mapst _encoding(R-R(R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3rs cCsX|drPd|dkr&d|dS|j|d}|rP|d|dSn|dS(s7Builds a qualified name from a (ns_url, localname) pairis$http://www.w3.org/XML/1998/namespacesxml:it:(R7(R-tnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qname|s
cCs|jd|j�dS(Nu$<?xml version="1.0" encoding="%s"?>
(R4R9(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
startDocument�s cCs|j�dS(N(R5(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendDocument�scCs@|jj|jj��||j|<|jj||f�dS(N(R6tappendR7RR8(R-R<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMapping�s
cCs|jd|_|jd=dS(Ni����(R6R7(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendPrefixMapping�scCs\|jd|�x7|j�D])\}}|jd|t|�f�qW|jd�dS(Nu<u %s=%su>(R4RR(R-R;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElement�s!cCs|jd|�dS(Nu</%s>(R4(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
endElement�scCs�|jd|j|��xH|jD]=\}}|rP|jd||f�q$|jd|�q$Wg|_x@|j�D]2\}}|jd|j|�t|�f�q{W|jd�dS(Nu<u xmlns:%s="%s"u xmlns="%s"u %s=%su>(R4R=R8RR(R-R;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNS�s *cCs|jd|j|��dS(Nu</%s>(R4R=(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendElementNS�scCs;t|t�s$t||j�}n|jt|��dS(N(RtunicodeR9R4R(R-tcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
characters�scCs5t|t�s$t||j�}n|j|�dS(N(RRJR9R4(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespace�scCs|jd||f�dS(Nu <?%s %s?>(R4(R-ttargetR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstruction�sN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ps
t
XMLFilterBasecBs
eZdZdd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sYThis class is designed to sit between an XMLReader and the
client application's event handlers. By default, it does nothing
but pass requests up to the reader and events on to the handlers
unmodified, but subclasses can override specific methods to modify
the event stream or the configuration requests as they pass
through.cCstjj|�||_dS(N(t xmlreadert XMLReaderR3t_parent(R-tparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3�scCs|jj|�dS(N(t_err_handlerterror(R-t exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRV�scCs|jj|�dS(N(RUt
fatalError(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRX�scCs|jj|�dS(N(RUtwarning(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRY�scCs|jj|�dS(N(t
_cont_handlertsetDocumentLocator(R-tlocator((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[�scCs|jj�dS(N(RZR>(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR>�scCs|jj�dS(N(RZR?(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR?�scCs|jj||�dS(N(RZRB(R-R<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRB�scCs|jj|�dS(N(RZRC(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRC�scCs|jj||�dS(N(RZRE(R-R;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRE�scCs|jj|�dS(N(RZRF(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRF�scCs|jj|||�dS(N(RZRH(R-R;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRH�scCs|jj||�dS(N(RZRI(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRI�scCs|jj|�dS(N(RZRL(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRL�scCs|jj|�dS(N(RZRM(R-tchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRM�scCs|jj||�dS(N(RZRO(R-RNR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|�dS(N(RZt
skippedEntity(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||�dS(N(t_dtd_handlertnotationDecl(R-R;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR` scCs|jj||||�dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRcscCs|jj||�S(N(t_ent_handlert
resolveEntity(R-RaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj|�|jj|�|jj|�|jj|�|jj|�dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert
setDTDHandlertparse(R-tsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks
cCs|jj|�dS(N(RSt setLocale(R-tlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|�S(N(RSt
getFeature(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||�dS(N(RSt
setFeature(R-R;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|�S(N(RStgetProperty(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||�dS(N(RStsetProperty(R-R;R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt getParent.scCs
||_dS(N(RS(R-RT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRP�s: RcCst|�tkr$tj|�}nSt|d�rw|}tj�}|j|�t|d�rw|j|j�qwn|j�dkry|j
�}tjj
tjj|��}tj�}t|t�rt|t�sdy|j|�}Wqtk
r|j|�}qXqdnHt|t�rdy|j|�}Wqdtk
r`|j|�}qdXntjj||�}tjj|�}Wntk
r�t}nX|r�|j|�t|d�}n4|jtj||j
���tj|j
��}|j|�n|S(s�This function takes an InputSource and an optional base URL and
returns a fully resolved InputSource object ready for reading.treadR;trbN(ttypet_StringTypesRQtInputSourcethasattrt
setByteStreamtsetSystemIdR;t
getByteStreamRtgetSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfiletUnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt
sysidfilenameR�((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF
(RvR�R�R�ttypesRRR1RQt
StringTypetUnicodeTypeRzR&RRR
RR*t
TextIOWrapperR'R2R0RRRPR�(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<module>s$0
Wo