ok

Mini Shell

Direktori : /proc/self/root/proc/thread-self/root/opt/alt/python27/lib64/python2.7/xml/sax/
Upload File :
Current File : //proc/self/root/proc/thread-self/root/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyc

�
�[
bc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej	ej
gZWnek
r�ej	gZnXd�Z
id�Zid�Zid�Zd�Zdejfd	��YZd
ejfd��YZdejfd
��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((s5/opt/alt/python27/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((s5/opt/alt/python27/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((s5/opt/alt/python27/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((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt	quoteattr5s"

cCs�|dkr$ddl}|j}nt|tj�rTtj|�}d�|_nTtj�}d�|_|j	|_	y|j
|_
|j|_Wntk
r�nXt
|d|dddd�S(	Ni����cSsdS(N(tNone(((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt<lambda>VtcSstS(N(tTrue(((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines
(Rtsyststdoutt
isinstancetiot	RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"
R'cBseZd�ZRS(cCs$tt|�j|�|j�dS(N(tsuperR'R#tflush(tselfR((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t
__module__R#(((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR'jst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*R#t_writeR,t_flusht_ns_contextst_current_contextt_undeclared_ns_mapst	_encoding(R-R(R((s5/opt/alt/python27/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((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt_qname|s
cCs|jd|j�dS(Nu$<?xml version="1.0" encoding="%s"?>
(R4R9(R-((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt
startDocument�s	cCs|j�dS(N(R5(R-((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytendDocument�scCs@|jj|jj��||j|<|jj||f�dS(N(R6tappendR7RR8(R-R<turi((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMapping�s
cCs|jd|_|jd=dS(Ni����(R6R7(R-R<((s5/opt/alt/python27/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((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytstartElement�s!cCs|jd|�dS(Nu</%s>(R4(R-R;((s5/opt/alt/python27/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((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytstartElementNS�s	*cCs|jd|j|��dS(Nu</%s>(R4R=(R-R;RG((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytendElementNS�scCs;t|t�s$t||j�}n|jt|��dS(N(RtunicodeR9R4R(R-tcontent((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt
characters�scCs5t|t�s$t||j�}n|j|�dS(N(RRJR9R4(R-RK((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespace�scCs|jd||f�dS(Nu	<?%s %s?>(R4(R-ttargetR
((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytprocessingInstruction�sN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR0ps
											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(R-tparent((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR3�scCs|jj|�dS(N(t_err_handlerterror(R-t	exception((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRV�scCs|jj|�dS(N(RUt
fatalError(R-RW((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRX�scCs|jj|�dS(N(RUtwarning(R-RW((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRY�scCs|jj|�dS(N(t
_cont_handlertsetDocumentLocator(R-tlocator((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR[�scCs|jj�dS(N(RZR>(R-((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR>�scCs|jj�dS(N(RZR?(R-((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR?�scCs|jj||�dS(N(RZRB(R-R<RA((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRB�scCs|jj|�dS(N(RZRC(R-R<((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRC�scCs|jj||�dS(N(RZRE(R-R;RD((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRE�scCs|jj|�dS(N(RZRF(R-R;((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRF�scCs|jj|||�dS(N(RZRH(R-R;RGRD((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRH�scCs|jj||�dS(N(RZRI(R-R;RG((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRI�scCs|jj|�dS(N(RZRL(R-RK((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRL�scCs|jj|�dS(N(RZRM(R-tchars((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRM�scCs|jj||�dS(N(RZRO(R-RNR
((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|�dS(N(RZt
skippedEntity(R-R;((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||�dS(N(t_dtd_handlertnotationDecl(R-R;tpublicIdtsystemId((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyR`	scCs|jj||||�dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRcscCs|jj||�S(N(t_ent_handlert
resolveEntity(R-RaRb((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj|�|jj|�|jj|�|jj|�|jj|�dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert
setDTDHandlertparse(R-tsource((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRks
cCs|jj|�dS(N(RSt	setLocale(R-tlocale((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|�S(N(RSt
getFeature(R-R;((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||�dS(N(RSt
setFeature(R-R;tstate((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|�S(N(RStgetProperty(R-R;((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||�dS(N(RStsetProperty(R-R;R((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt	getParent.scCs
||_dS(N(RS(R-RT((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt	setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s5/opt/alt/python27/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
�}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
getByteStreamRtgetSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfiletUnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt
sysidfilenameR�((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF





(RvR�R�R�ttypesRRR1RQt
StringTypetUnicodeTypeRzR&RRR
RR*t
TextIOWrapperR'R2R0RRRPR�(((s5/opt/alt/python27/lib64/python2.7/xml/sax/saxutils.pyt<module>s$0
		Wo

Zerion Mini Shell 1.0