Your IP : 3.145.55.25


Current Path : /opt/alt/python310/lib64/python3.10/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/xml/dom/__pycache__/xmlbuilder.cpython-310.pyc

o

6��fc0�@s�dZddlZddlZddlmZgd�ZGdd�d�ZGdd�d�Zd	d
�Z	Gdd�de
�ZGd
d�de
�ZGdd�d�Z
[Gdd�d�ZGdd�d�ZdS)z4Implementation of the DOM Level 3 'LS-Load' feature.�N)�
NodeFilter)�
DOMBuilder�DOMEntityResolver�DOMInputSourcec@s\eZdZdZdZdZdZdZdZdZ	dZ
dZdZdZ
dZdZdZdZdZdZdZdZdZdS)�Optionsz�Features object that has variables set for each DOMBuilder feature.

    The DOMBuilder class uses an instance of this class to pass settings to
    the ExpatBuilder class.
    �TFN)�__name__�
__module__�__qualname__�__doc__�
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�9/opt/alt/python310/lib64/python3.10/xml/dom/xmlbuilder.pyrs*	rc
@s`eZdZdZdZdZdZdZdZdZ	eeee	fZ
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Ziddg�ddg�ddg�ddg�ddg�ddg�d d g�d!d!g�d"d"g�d#d#g�d$d"d$g�d%d%g�d&d&g�d'd'g�d(d(g�d)d)g�d*d*g�d+gd,gd-gggd.�d/gd0gd1gd2��Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�ZdS)=rNr���cCst�|_dS�N)r�_options��selfrrr�__init__9szDOMBuilder.__init__cC�|jSr"��entityResolverr$rrr�_get_entityResolver<�zDOMBuilder._get_entityResolvercC�
||_dSr"r()r%r)rrr�_set_entityResolver>�
zDOMBuilder._set_entityResolvercCr'r"�rr$rrr�_get_errorHandlerAr+zDOMBuilder._get_errorHandlercCr,r"r/)r%rrrr�_set_errorHandlerCr.zDOMBuilder._set_errorHandlercCr'r"�rr$rrr�_get_filterFr+zDOMBuilder._get_filtercCr,r"r2)r%rrrr�_set_filterHr.zDOMBuilder._set_filtercCs�|�|�r8|r	dp
d}z|jt|�|f}Wnty'tj�d|f�d�w|D]\}}t|j||�q*dStj�	dt
|���)Nrrzunsupported feature: %rzunknown feature: )�supportsFeature�	_settings�_name_xform�KeyError�xml�dom�NotSupportedErr�setattrr#�NotFoundErr�repr)r%�name�stateZsettings�valuerrr�
setFeatureKs
����zDOMBuilder.setFeaturecCst|jt|��Sr")�hasattrr#r7)r%r?rrrr5Y�zDOMBuilder.supportsFeaturecCst|�|rdpdf}||jvS)Nrr)r7r6)r%r?r@�keyrrr�
canSetFeature\s
zDOMBuilder.canSetFeature�r
r)r
r)rr)rr)rr)rr)rr�rr�rr)rr�rr)rr)rr�rr�rr)rr)rr�rr�rr�rr)	rGrHrIrJrL)rrrKrMrO�rr�rr�rr)rMrNrO)rr)rrrPrQrRcCs�t|�}zt|j|�WStyA|dkr7|j}|jo4|jo4|jo4|jo4|jp3|j	p3|j
p3|jp3|jYSt
j�dt|���w)Nrzfeature %s not known)r7�getattrr#�AttributeErrorrrrrr
rrrrr9r:r=r>)r%r?Zxname�optionsrrr�
getFeature�s2��������	�zDOMBuilder.getFeaturecCs.|jr|j�d|�}nt��d|�}|�|�Sr")r)�
resolveEntityr�parse)r%�uri�inputrrr�parseURI�s
zDOMBuilder.parseURIcCsRt�|j�}|j|_|j|_|j}|dur#|jr#ddl}|j�|j�}|�	||�S�Nr)
�copyr#rr�
byteStream�systemId�urllib.request�requestZurlopen�_parse_bytestream)r%rZrU�fp�urllibrrrrX�szDOMBuilder.parsecCs||jvr	td��td��)Nznot a legal actionzHaven't written this yet...)�_legal_actions�
ValueError�NotImplementedError)r%rZZcnode�actionrrr�parseWithContext�s
zDOMBuilder.parseWithContextcCs ddl}|jj�|�}|�|�Sr\)Zxml.dom.expatbuilderr:ZexpatbuilderZmakeBuilderZ	parseFile)r%�streamrUr9Zbuilderrrrrb�s
zDOMBuilder._parse_bytestream)rr	r
r)rrZACTION_REPLACEZACTION_APPEND_AS_CHILDRENZACTION_INSERT_AFTERZACTION_INSERT_BEFORErer&r*r-r0r1r3r4rBr5rFr6rVr[rXrirbrrrrr,s��	��������	����
������������������ ��"��%�������=
rcCs|���dd�S)N�-�_)�lower�replace)r?rrrr7�rDr7c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r)�_openerc
Cs�|dusJ�t�}||_||_|���|�|_|�|�|_ddl}ddl	}|j
�|�}|\}}}	}
}}|	rP|	�d�sP|�
|	�d}	|||	|
||f}|j
�|�|_|S)Nr�/)r�publicIdr_�_get_opener�openr^�_guess_media_encoding�encoding�	posixpathZurllib.parserXZurlparse�endswith�dirnameZ
urlunparse�baseURI)
r%rqr_�sourcervrd�partsZschemeZnetloc�path�paramsZqueryZfragmentrrrrW�szDOMEntityResolver.resolveEntitycCs,z|jWSty|��|_|jYSwr")rorT�_create_openerr$rrrrr�s

�zDOMEntityResolver._get_openercCsddl}|j��Sr\)r`raZbuild_opener)r%rdrrrr~�s
z DOMEntityResolver._create_openercCsJ|j��}d|vr!|��D]}|�d�r |�dd�d��Sq
dSdS)NzContent-Typezcharset=�=r)r^�infoZgetplist�
startswith�splitrm)r%rzr�Zparamrrrrt�s

��z'DOMEntityResolver._guess_media_encodingN)rr	r
�	__slots__rWrrr~rtrrrrr�src@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!r�r^�characterStream�
stringDatarurqr_rycCs.d|_d|_d|_d|_d|_d|_d|_dSr"r�r$rrrr&s
zDOMInputSource.__init__cCr'r"�r^r$rrr�_get_byteStream
r+zDOMInputSource._get_byteStreamcCr,r"r�)r%r^rrr�_set_byteStreamr.zDOMInputSource._set_byteStreamcCr'r"�r�r$rrr�_get_characterStreamr+z#DOMInputSource._get_characterStreamcCr,r"r�)r%r�rrr�_set_characterStreamr.z#DOMInputSource._set_characterStreamcCr'r"�r�r$rrr�_get_stringDatar+zDOMInputSource._get_stringDatacCr,r"r�)r%�datarrr�_set_stringDatar.zDOMInputSource._set_stringDatacCr'r"�rur$rrr�
_get_encodingr+zDOMInputSource._get_encodingcCr,r"r�)r%rurrr�
_set_encodingr.zDOMInputSource._set_encodingcCr'r"�rqr$rrr�
_get_publicId!r+zDOMInputSource._get_publicIdcCr,r"r�)r%rqrrr�
_set_publicId#r.zDOMInputSource._set_publicIdcCr'r"�r_r$rrr�
_get_systemId&r+zDOMInputSource._get_systemIdcCr,r"r�)r%r_rrr�
_set_systemId(r.zDOMInputSource._set_systemIdcCr'r"�ryr$rrr�_get_baseURI+r+zDOMInputSource._get_baseURIcCr,r"r��r%rYrrr�_set_baseURI-r.zDOMInputSource._set_baseURIN)rr	r
r�r&r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrs"	rc@s>eZdZdZdZdZdZdZej	Z
dd�Zdd	�Zd
d�Z
dS)
�DOMBuilderFilterzSElement filter which can be used to tailor construction of
    a DOM instance.
    rrr r!cCr'r")�
whatToShowr$rrr�_get_whatToShowBr+z DOMBuilderFilter._get_whatToShowcCr'r"��
FILTER_ACCEPT�r%Zelementrrr�
acceptNodeEr+zDOMBuilderFilter.acceptNodecCr'r"r�r�rrr�startContainerHr+zDOMBuilderFilter.startContainerN)rr	r
rr�Z
FILTER_REJECTZFILTER_SKIPZFILTER_INTERRUPTrZSHOW_ALLr�r�r�r�rrrrr�1s	r�c@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�
DocumentLSz=Mixin to create documents that conform to the load/save spec.FcCsdS)NFrr$rrr�
_get_asyncSszDocumentLS._get_asynccCs|rtj�d��dS)Nz.asynchronous document loading is not supported)r9r:r;)r%�flagrrr�
_set_asyncVs
��zDocumentLS._set_asynccC�td��)Nz'haven't figured out what this means yet�rgr$rrr�abort[s�zDocumentLS.abortcCr��Nzhaven't written this yetr�r�rrr�loada�zDocumentLS.loadcCr�r�r�)r%rzrrr�loadXMLdr�zDocumentLS.loadXMLcCs0|dur
|}|��S|j|urtj���|��Sr")Z
ownerDocumentr9r:ZWrongDocumentErrZtoxml)r%Zsnoderrr�saveXMLgs
�
zDocumentLS.saveXMLN)rr	r
rZasync_r�r�r�r�r�r�rrrrr�Nsr�c@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�DOMImplementationLSrrcCsB|dur
tj�d��||jkrt�S||jkrtj�d��td��)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)r9r:r;�MODE_SYNCHRONOUSr�MODE_ASYNCHRONOUSrf)r%�modeZ
schemaTyperrr�createDOMBuilderss�

�z$DOMImplementationLS.createDOMBuildercCr�)Nz-the writer interface hasn't been written yet!r�r$rrr�createDOMWriter~s�z#DOMImplementationLS.createDOMWritercCst�Sr")rr$rrr�createDOMInputSource�r+z(DOMImplementationLS.createDOMInputSourceN)rr	r
r�r�r�r�r�rrrrr�osr�)rr]Zxml.domr9Zxml.dom.NodeFilterr�__all__rrr7�objectrrr�r�r�rrrr�<module>s %,1!

?>