Your IP : 18.191.171.136


Current Path : /opt/alt/python35/lib64/python3.5/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/xml/dom/__pycache__/xmlbuilder.cpython-35.opt-2.pyc



���]�2�@s�ddlZddlZddlZddlmZdddgZGdd�d�ZGdd�d�Zd	d
�Z	Gdd�de
�ZGdd�de
�ZGd
d�d�Z
[Gdd�d�ZGdd�d�Z[Gdd�d�ZdS)�N)�
NodeFilter�
DOMBuilder�DOMEntityResolver�DOMInputSourcec@s�eZdZdZdZdZdZdZdZdZ	dZ
dZdZdZ
dZdZdZdZdZdZdZdZdS)�Options�TFN)�__name__�
__module__�__qualname__�
namespaces�namespace_declarations�
validation�external_parameter_entities�external_general_entitiesZexternal_dtd_subset�validate_if_schemaZvalidate�datatype_normalization�create_entity_ref_nodes�entities�whitespace_in_element_content�cdata_sections�comments�charset_overrides_xml_encoding�infoset�supported_mediatypes_only�errorHandler�filter�rr�//opt/alt/python35/lib64/python3.5/xmlbuilder.pyr
s&
rc5@s�eZdZdZdZdZdZdZdZdZ	eeee	fZ
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd4d5gd6d7gd8d9gd:d;gd<d=gd>d?gd@dAgdBdCgdDdEgdFdGgdHdIdJgdKdLgdMdNgdOdPgdQdRgdSdTgdUdVgdWdXgdYdZgd[d\gd]gd^d_d`dadbdcdddedfdgg	dhdigdjdkgdldmgiZd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�ZdS)nrNr���cCst�|_dS)N)r�_options)�selfrrr�__init__:szDOMBuilder.__init__cCs|jS)N)�entityResolver)r"rrr�_get_entityResolver=szDOMBuilder._get_entityResolvercCs
||_dS)N)r$)r"r$rrr�_set_entityResolver?szDOMBuilder._set_entityResolvercCs|jS)N)r)r"rrr�_get_errorHandlerBszDOMBuilder._get_errorHandlercCs
||_dS)N)r)r"rrrr�_set_errorHandlerDszDOMBuilder._set_errorHandlercCs|jS)N)r)r"rrr�_get_filterGszDOMBuilder._get_filtercCs
||_dS)N)r)r"rrrr�_set_filterIszDOMBuilder._set_filterc
Cs�|j|�r�|rdpd}y|jt|�|f}Wn+tk
rktjjd|f��Yq�XxF|D]\}}t|j||�qsWntjj	dt
|���dS)Nrrzunsupported feature: %rzunknown feature: )�supportsFeature�	_settings�_name_xform�KeyError�xml�dom�NotSupportedErr�setattrr!�NotFoundErr�repr)r"�name�stateZsettings�valuerrr�
setFeatureLs
	zDOMBuilder.setFeaturecCst|jt|��S)N)�hasattrr!r-)r"r5rrrr+ZszDOMBuilder.supportsFeaturecCs+t|�|rdpdf}||jkS)Nrr)r-r,)r"r5r6�keyrrr�
canSetFeature]szDOMBuilder.canSetFeaturerrr
rrrrrrrrrrrrrcCs�t|�}yt|j|�SWn�tk
r�|dkr�|j}|jo�|jo�|jo�|jo�|jp�|j	p�|j
p�|jp�|jSt
jjdt|���YnXdS)Nrzfeature %s not known)r-�getattrr!�AttributeErrorrrrrrrrrrr/r0r3r4)r"r5Zxname�optionsrrr�
getFeature�s 
									zDOMBuilder.getFeaturecCsC|jr!|jjd|�}nt�jd|�}|j|�S)N)r$�
resolveEntityr�parse)r"�uri�inputrrr�parseURI�s	zDOMBuilder.parseURIcCsytj|j�}|j|_|j|_|j}|dkri|jriddl}|jj|j�}|j	||�S)Nr)
�copyr!rr�
byteStream�systemId�urllib.request�request�urlopen�_parse_bytestream)r"rCr>�fp�urllibrrrrA�s	zDOMBuilder.parsecCs+||jkrtd��td��dS)Nznot a legal actionzHaven't written this yet...)�_legal_actions�
ValueError�NotImplementedError)r"rCZcnode�actionrrr�parseWithContext�szDOMBuilder.parseWithContextcCs.ddl}|jjj|�}|j|�S)Nr)Zxml.dom.expatbuilderr0ZexpatbuilderZmakeBuilderZ	parseFile)r"�streamr>r/ZbuilderrrrrK�szDOMBuilder._parse_bytestream)rr)rr)rr)rr)r
r)r
r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr	r
r$rrZACTION_REPLACEZACTION_APPEND_AS_CHILDRENZACTION_INSERT_AFTERZACTION_INSERT_BEFORErNr#r%r&r'r(r)r*r8r+r;r,r?rDrArRrKrrrrr-s�

cCs|j�jdd�S)N�-�_)�lower�replace)r5rrrr-�sr-c@sFeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�_openerc
Cs�t�}||_||_|j�j|�|_|j|�|_ddl}ddl	}|j
j|�}|\}}}	}
}}|	r�|	jd�r�|j
|	�d}	|||	|
||f}|j
j|�|_|S)Nr�/)r�publicIdrG�_get_opener�openrF�_guess_media_encoding�encoding�	posixpathZurllib.parserA�urlparse�endswith�dirnameZ
urlunparse�baseURI)
r"rZrG�sourcer_rM�parts�schemeZnetloc�path�paramsZqueryZfragmentrrrr@�s			zDOMEntityResolver.resolveEntitycCs:y|jSWn(tk
r5|j�|_|jSYnXdS)N)rXr=�_create_opener)r"rrrr[�s

zDOMEntityResolver._get_openercCsddl}|jj�S)Nr)rHrIZbuild_opener)r"rMrrrri�sz DOMEntityResolver._create_openercCs_|jj�}d|kr[x=|j�D]/}|jd�r(|jdd�dj�Sq(WdS)NzContent-Typezcharset=�=r)rF�infoZgetplist�
startswith�splitrV)r"rdrkZparamrrrr]�s
z'DOMEntityResolver._guess_media_encodingN)rX)rr	r
�	__slots__r@r[rir]rrrrr�s
c@s�eZdZd'Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&S)(rrF�characterStream�
stringDatar^rZrGrccCsCd|_d|_d|_d|_d|_d|_d|_dS)N)rFrorpr^rZrGrc)r"rrrr#s						zDOMInputSource.__init__cCs|jS)N)rF)r"rrr�_get_byteStreamszDOMInputSource._get_byteStreamcCs
||_dS)N)rF)r"rFrrr�_set_byteStreamszDOMInputSource._set_byteStreamcCs|jS)N)ro)r"rrr�_get_characterStreamsz#DOMInputSource._get_characterStreamcCs
||_dS)N)ro)r"rorrr�_set_characterStreamsz#DOMInputSource._set_characterStreamcCs|jS)N)rp)r"rrr�_get_stringDataszDOMInputSource._get_stringDatacCs
||_dS)N)rp)r"�datarrr�_set_stringDataszDOMInputSource._set_stringDatacCs|jS)N)r^)r"rrr�
_get_encodingszDOMInputSource._get_encodingcCs
||_dS)N)r^)r"r^rrr�
_set_encodingszDOMInputSource._set_encodingcCs|jS)N)rZ)r"rrr�
_get_publicId"szDOMInputSource._get_publicIdcCs
||_dS)N)rZ)r"rZrrr�
_set_publicId$szDOMInputSource._set_publicIdcCs|jS)N)rG)r"rrr�
_get_systemId'szDOMInputSource._get_systemIdcCs
||_dS)N)rG)r"rGrrr�
_set_systemId)szDOMInputSource._set_systemIdcCs|jS)N)rc)r"rrr�_get_baseURI,szDOMInputSource._get_baseURIcCs
||_dS)N)rc)r"rBrrr�_set_baseURI.szDOMInputSource._set_baseURIN)rFrorpr^rZrGrc)rr	r
rnr#rqrrrsrtrurwrxryrzr{r|r}r~rrrrrrs"	c@sUeZdZdZdZdZdZejZ	dd�Z
dd�Zd	d
�ZdS)�DOMBuilderFilterrrrr cCs|jS)N)�
whatToShow)r"rrr�_get_whatToShowCsz DOMBuilderFilter._get_whatToShowcCs|jS)N)�
FILTER_ACCEPT)r"�elementrrr�
acceptNodeFszDOMBuilderFilter.acceptNodecCs|jS)N)r�)r"r�rrr�startContainerIszDOMBuilderFilter.startContainerN)
rr	r
r�Z
FILTER_REJECTZFILTER_SKIPZFILTER_INTERRUPTrZSHOW_ALLr�r�r�r�rrrrr�2s
	r�c@s4eZdZdd�Zdd�Zdd�ZdS)�_AsyncDeprecatedPropertycCs)|j}tjdjd|�t�dS)Nz+{cls}.async is deprecated; use {cls}.async_�cls)r�warnings�warn�format�DeprecationWarning)r"r�Zclsnamerrrr�Ps	z_AsyncDeprecatedProperty.warncCs$|j|�|dk	r |jSdS)NF)r��async_)r"�instancer�rrr�__get__Vs
z _AsyncDeprecatedProperty.__get__cCs'|jt|��t|d|�dS)Nr�)r��typer2)r"r�r7rrr�__set__\sz _AsyncDeprecatedProperty.__set__N)rr	r
r�r�r�rrrrr�Osr�c@sgeZdZe�ZdZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�ZdS)�
DocumentLSFcCsdS)NFr)r"rrr�
_get_asyncgszDocumentLS._get_asynccCs|rtjjd��dS)Nz.asynchronous document loading is not supported)r/r0r1)r"�asyncrrr�
_set_asyncjs	zDocumentLS._set_asynccCstd��dS)Nz'haven't figured out what this means yet)rP)r"rrr�abortoszDocumentLS.abortcCstd��dS)Nzhaven't written this yet)rP)r"rBrrr�loaduszDocumentLS.loadcCstd��dS)Nzhaven't written this yet)rP)r"rdrrr�loadXMLxszDocumentLS.loadXMLcCs=|dkr|}n|j|k	r3tjj��|j�S)N)Z
ownerDocumentr/r0ZWrongDocumentErrZtoxml)r"Zsnoderrr�saveXML{s
	zDocumentLS.saveXMLN)rr	r
r�r�r�r�r�r�r�r�r�rrrrr�as	r�c@s@eZdZdZdZdd�Zdd�Zdd�Zd	S)
�DOMImplementationLSrrcCse|dk	rtjjd��||jkr4t�S||jkrUtjjd��td��dS)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)r/r0r1�MODE_SYNCHRONOUSr�MODE_ASYNCHRONOUSrO)r"�modeZ
schemaTyperrr�createDOMBuilder�s				z$DOMImplementationLS.createDOMBuildercCstd��dS)Nz-the writer interface hasn't been written yet!)rP)r"rrr�createDOMWriter�sz#DOMImplementationLS.createDOMWritercCst�S)N)r)r"rrr�createDOMInputSource�sz(DOMImplementationLS.createDOMInputSourceN)rr	r
r�r�r�r�r�rrrrr��s
r�)rEr�Zxml.domr/Zxml.dom.NodeFilterr�__all__rrr-�objectrrr�r�r�r�rrrr�<module>s �,1"

?>