Your IP : 18.218.83.44


Current Path : /lib64/python2.7/xml/sax/
Upload File :
Current File : //lib64/python2.7/xml/sax/saxutils.pyc

�
�mec@sdZddlZddlZddlZddlZddlZddlZddlZddlZyej	ej
gZWnek
r�ej	gZnXd�Z
id�Zid�Zid�Zd�Zdejfd	��YZd
ejfd��YZdd
�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&amp;t>s&gt;t<s&lt;(RR(tdatatentities((s(/usr/lib64/python2.7/xml/sax/saxutils.pytescapes	cCsL|jdd�}|jdd�}|r<t||�}n|jdd�S(s
Unescape &amp;, &lt;, and &gt; 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&lt;R	s&gt;Rs&amp;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&#10;s
s&#13;s
s&#9;s	t"t's"%s"s&quot;s'%s'(tcopytupdateRR(R
R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	quoteattr5s"

cs�|dkr$ddl}|j}nt|tj�rTtj|�}d�|_nTtj�}d�|_|j	|_	y|j
|_
|j|_Wntk
r�nXdtj
f�fd��Y��|d|ddd	d
�S(Ni����cSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<lambda>VscSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[stUnbufferedTextIOWrappercseZ�fd�ZRS(cs$t�|�j|�|j�dS(N(tsupertwritetflush(tselfR(R(s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfs(t__name__t
__module__R((R(s(/usr/lib64/python2.7/xml/sax/saxutils.pyRestencodingterrorstxmlcharrefreplacetnewlines
(Rtsyststdoutt
isinstancetiot	RawIOBasetBufferedIOBasetclosetwritableRtseekablettelltAttributeErrort
TextIOWrapper(toutRR!tbuffer((Rs(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs$
tXMLGeneratorcBs�eZddd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(s
iso-8859-1cCsitjj|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_dS(Ni����(thandlertContentHandlert__init__R/Rt_writeRt_flusht_ns_contextst_current_contextt_undeclared_ns_mapst	_encoding(RR-R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3os	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(Rtnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qnameys
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(RR<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMapping�s
cCs|jd|_|jd=dS(Ni����(R6R7(RR<((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(RR;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElement�s!cCs|jd|�dS(Nu</%s>(R4(RR;((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(RR;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNS�s	*cCs|jd|j|��dS(Nu</%s>(R4R=(RR;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendElementNS�scCs|jtt|���dS(N(R4Rtunicode(Rtcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
characters�scCs|jt|��dS(N(R4RJ(RRK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespace�scCs|jd||f�dS(Nu	<?%s %s?>(R4(RttargetR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstruction�sN(RRRR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ms
											t
XMLFilterBasecBs
eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�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(Rtparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3�scCs|jj|�dS(N(t_err_handlerterror(Rt	exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRV�scCs|jj|�dS(N(RUt
fatalError(RRW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRX�scCs|jj|�dS(N(RUtwarning(RRW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRY�scCs|jj|�dS(N(t
_cont_handlertsetDocumentLocator(Rtlocator((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(RR<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRB�scCs|jj|�dS(N(RZRC(RR<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRC�scCs|jj||�dS(N(RZRE(RR;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRE�scCs|jj|�dS(N(RZRF(RR;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRF�scCs|jj|||�dS(N(RZRH(RR;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRH�scCs|jj||�dS(N(RZRI(RR;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRI�scCs|jj|�dS(N(RZRL(RRK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRL�scCs|jj|�dS(N(RZRM(Rtchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRM�scCs|jj||�dS(N(RZRO(RRNR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRO�scCs|jj|�dS(N(RZt
skippedEntity(RR;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^�scCs|jj|||�dS(N(t_dtd_handlertnotationDecl(RR;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR`scCs|jj||||�dS(N(R_tunparsedEntityDecl(RR;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRcscCs|jj||�S(N(t_ent_handlert
resolveEntity(RRaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRf
scCsT|jj|�|jj|�|jj|�|jj|�|jj|�dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert
setDTDHandlertparse(Rtsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks
cCs|jj|�dS(N(RSt	setLocale(Rtlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|�S(N(RSt
getFeature(RR;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRoscCs|jj||�dS(N(RSt
setFeature(RR;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRpscCs|jj|�S(N(RStgetProperty(RR;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRrscCs|jj||�dS(N(RStsetProperty(RR;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(RRT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	setParent*sN( RRt__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRP�s:																										tcCst|�tkr$tj|�}nSt|d�rw|}tj�}|j|�t|d�rw|j|j�qwn|j�dkry|j
�}tjj
tjj|��}tj�}t|t�rt|t�sdy|j|�}Wqtk
r|j|�}qXqdnHt|t�rdy|j|�}Wqdtk
r`|j|�}qdXntjj||�}tjj|�}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
getByteStreamRtgetSystemIdtostpathtdirnametnormpathR!tgetfilesystemencodingR#RJtdecodetUnicodeDecodeErrortencodetjointisfiletUnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt
sysidfilenameR�((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source/sF





(RvR�R�R�ttypesR$R!R1RQt
StringTypetUnicodeTypeR{R+RRR
RR/R2R0RRRPR�(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<module>s"0
		 So