Your IP : 3.21.46.129


Current Path : /opt/alt/python312/lib64/python3.12/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/xml/dom/__pycache__/xmlbuilder.cpython-312.opt-1.pyc

�

�Q�fc0����dZddlZddlZddlmZgd�ZGd�d�ZGd�d�Zd	�Z	Gd
�de
�ZGd�d
e
�ZGd�d�Z
[Gd�d�ZGd�d�Zy)z4Implementation of the DOM Level 3 'LS-Load' feature.�N)�
NodeFilter)�
DOMBuilder�DOMEntityResolver�DOMInputSourcec�\�eZdZdZdZdZdZdZdZdZ	dZ
dZdZdZ
dZdZdZdZdZdZdZdZdZy)�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_entities�external_dtd_subset�validate_if_schema�validate�datatype_normalization�create_entity_ref_nodes�entities�whitespace_in_element_content�cdata_sections�comments�charset_overrides_xml_encoding�infoset�supported_mediatypes_only�errorHandler�filter���9/opt/alt/python312/lib64/python3.12/xml/dom/xmlbuilder.pyrrsr����J�!���J�"&�� $�������H�"��"���H�$(�!��N��H�%)�"��G� %���L�
�Fr"rc
�B�eZdZdZdZdZdZdZdZdZ	eeee	fZ
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Ziddg�ddg�ddg�ddg�ddg�ddg�ddg�ddg�ddg�ddg�dddg�ddg�ddg�ddg�ddg�ddg�d d g�d!gd"gd#gggd$�d%gd&gd'gd(��Zd)�Zd*�Zd+�Zd,�Zd-�Zy).rNr	���c�"�t�|_y�N)r�_options��selfs r#�__init__zDOMBuilder.__init__9s���	��
r"c��|jSr)��entityResolverr+s r#�_get_entityResolverzDOMBuilder._get_entityResolver<s���"�"�"r"c��||_yr)r/)r,r0s  r#�_set_entityResolverzDOMBuilder._set_entityResolver>s
��,��r"c��|jSr)�rr+s r#�_get_errorHandlerzDOMBuilder._get_errorHandlerAs��� � � r"c��||_yr)r5)r,rs  r#�_set_errorHandlerzDOMBuilder._set_errorHandlerCs
��(��r"c��|jSr)�r r+s r#�_get_filterzDOMBuilder._get_filterFs���{�{�r"c��||_yr)r:)r,r s  r#�_set_filterzDOMBuilder._set_filterHs	����r"c�h�|j|�rG|xrdxsd}	|jt|�|f}|D]\}}t|j||��ytjjdt|�z��#t
$r$tjjd|���d�wxYw)Nr	rzunsupported feature: zunknown feature: )�supportsFeature�	_settings�_name_xform�setattrr*�KeyError�xml�dom�NotSupportedErr�NotFoundErr�repr)r,�name�state�settings�values     r#�
setFeaturezDOMBuilder.setFeatureKs�������%��K�a�$�1�E�
8��>�>�;�t�+<�e�*D�E��
$,�K�D�%��D�M�M�4��7�$,��'�'�%�%�&9�D��J�&F�G�G���
C��g�g�-�-�15�7�9�>B�C�
C�s�B�-B1c�@�t|jt|��Sr))�hasattrr*rA)r,rIs  r#r?zDOMBuilder.supportsFeatureYs���t�}�}�k�$�&7�8�8r"c�H�t|�|xrdxsdf}||jvS)Nr	r)rAr@)r,rIrJ�keys    r#�
canSetFeaturezDOMBuilder.canSetFeature\s)���4� �%�+�A�"2��3���d�n�n�$�$r"�rr)rr	)rr)rr)rr	)rr)rr	�rr�rr)rr	�rr)rr	)rr�rr	�rr)rr	)rr�rr	�rr�rr	)	rSrTrUrVrX)rr	rWrYr[�rr�rr�rr	)rYrZr[)rr)rr	r\r]r^c���t|�}	t|j|�S#t$r�|dk(r�|j}|jxro|j
xra|jxrS|jxrE|jxs6|jxs(|jxs|jxs|jcYStjjdt!|�z��wxYw)Nrzfeature %s not known)rA�getattrr*�AttributeErrorrrrrrrrrrrDrErGrH)r,rI�xname�optionss    r#�
getFeaturezDOMBuilder.getFeature�s����D�!��	K��4�=�=�%�0�0���	K��y� ��-�-���6�6�<�#�A�A�<�#�,�,�<�$�B�B�<�")�!?�!?�";�$+�$>�$>�";�$+�$C�$C�";�%,�$4�$4�";�%,�$:�$:�	<�	=��'�'�%�%�&<�t�D�z�&I�J�J�	K�s�#�BC(�<,C(c��|jr|jjd|�}nt�jd|�}|j|�Sr))r0�
resolveEntityr�parse)r,�uri�inputs   r#�parseURIzDOMBuilder.parseURI�sG������'�'�5�5�d�C�@�E�%�'�5�5�d�C�@�E��z�z�%� � r"c�.�tj|j�}|j|_|j|_|j}|�5|j
r)ddl}|jj|j
�}|j||�S�Nr)
�copyr*r r�
byteStream�systemId�urllib.request�request�urlopen�_parse_bytestream)r,rirc�fp�urllibs     r#rgzDOMBuilder.parse�ss���)�)�D�M�M�*�������#�0�0���
�
�
��
�:�'�*�*�!����'�'����7�B��%�%�b�'�2�2r"c�J�||jvrtd��td��)Nznot a legal actionzHaven't written this yet...)�_legal_actions�
ValueError�NotImplementedError)r,ri�cnode�actions    r#�parseWithContextzDOMBuilder.parseWithContext�s(����,�,�,��1�2�2�!�"?�@�@r"c�v�ddl}|jjj|�}|j	|�Srl)�xml.dom.expatbuilderrE�expatbuilder�makeBuilder�	parseFile)r,�streamrcrD�builders     r#rszDOMBuilder._parse_bytestream�s0��#��'�'�&�&�2�2�7�;��� � ��(�(r")r
rrr0rr �ACTION_REPLACE�ACTION_APPEND_AS_CHILDREN�ACTION_INSERT_AFTER�ACTION_INSERT_BEFORErwr-r1r3r6r8r;r=rMr?rRr@rdrjrgr|rsr!r"r#rr,s���N��L�
�F��N� !������$�&?�)�+?�A�N�"�#�-�!�)���H�9�%�;�%�)�(+�;�	&�)�(+�;�
	���;�	)�,�+.�;�	)�,�+.�;�	+�.�-0�;�	+�.�-0�;�	"�%�$'�;�"	'�*�),�#;�&	'�*�),�';�*	�*���+;�0	���1;�4	-�0�/2�5;�8	-�0�/2�9;�<	�!� #�=;�@	�!� #�A;�D	���E;�J
��
2�03�
2�03��	3�
-�+.�
��
��s;�I�zK�$!�3�A�
)r"rc�B�|j�jdd�S)N�-�_)�lower�replace)rIs r#rArA�s���:�:�<����S�)�)r"c�(�eZdZdZd�Zd�Zd�Zd�Zy)r)�_openerc��t�}||_||_|j�j	|�|_|j
|�|_ddl}ddl	}|jj|�}|\}}}	}
}}|	rM|	jd�s<|j|	�dz}	|||	|
||f}|jj|�|_|S)Nr�/)r�publicIdro�_get_opener�openrn�_guess_media_encoding�encoding�	posixpath�urllib.parserg�urlparse�endswith�dirname�
urlunparse�baseURI)
r,r�ro�sourcer�ru�parts�scheme�netloc�path�params�query�fragments
             r#rfzDOMEntityResolver.resolveEntity�s����!��"���"��� �,�,�.�3�3�H�=����4�4�V�<���	'����%�%�h�/��8=�5����f�e�X���
�
�c�*��$�$�T�*�S�0�D��F�D�&�%��A�E�#�\�\�4�4�U�;�F�N��
r"c�|�	|jS#t$r$|j�|_|jcYSwxYwr))r�ra�_create_openerr+s r#r�zDOMEntityResolver._get_opener�s:��	 ��<�<����	 ��.�.�0�D�L��<�<��	 �s��*;�;c�>�ddl}|jj�Srl)rprq�build_opener)r,rus  r#r�z DOMEntityResolver._create_opener�s����~�~�*�*�,�,r"c���|jj�}d|vrL|j�D]8}|jd�s�|j	dd�dj�cSyy)NzContent-Typezcharset=�=r	)rn�info�getplist�
startswith�splitr�)r,r�r��params    r#r�z'DOMEntityResolver._guess_media_encoding�s`��� � �%�%�'���T�!�������#�#�J�/� �;�;�s�A�.�q�1�7�7�9�9�)�"r"N)r
rr�	__slots__rfr�r�r�r!r"r#rr�s���I��, �-�:r"rc�j�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)r�rn�characterStream�
stringDatar�r�ror�c�f�d|_d|_d|_d|_d|_d|_d|_yr)r�r+s r#r-zDOMInputSource.__init__s4�����#��������
���
���
���r"c��|jSr)�rnr+s r#�_get_byteStreamzDOMInputSource._get_byteStream
������r"c��||_yr)r�)r,rns  r#�_set_byteStreamzDOMInputSource._set_byteStreams	��$��r"c��|jSr)�r�r+s r#�_get_characterStreamz#DOMInputSource._get_characterStreams���#�#�#r"c��||_yr)r�)r,r�s  r#�_set_characterStreamz#DOMInputSource._set_characterStreams
��.��r"c��|jSr)�r�r+s r#�_get_stringDatazDOMInputSource._get_stringDatar�r"c��||_yr)r�)r,�datas  r#�_set_stringDatazDOMInputSource._set_stringDatas	����r"c��|jSr)�r�r+s r#�
_get_encodingzDOMInputSource._get_encoding����}�}�r"c��||_yr)r�)r,r�s  r#�
_set_encodingzDOMInputSource._set_encoding�	�� ��
r"c��|jSr)�r�r+s r#�
_get_publicIdzDOMInputSource._get_publicId!r�r"c��||_yr)r�)r,r�s  r#�
_set_publicIdzDOMInputSource._set_publicId#r�r"c��|jSr)�ror+s r#�
_get_systemIdzDOMInputSource._get_systemId&r�r"c��||_yr)r�)r,ros  r#�
_set_systemIdzDOMInputSource._set_systemId(r�r"c��|jSr)�r�r+s r#�_get_baseURIzDOMInputSource._get_baseURI+s���|�|�r"c��||_yr)r��r,rhs  r#�_set_baseURIzDOMInputSource._set_baseURI-s	����r"N)r
rrr�r-r�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r"r#rrsU��@�I���%�$�/����!��!��!��r"rc�J�eZdZdZdZdZdZdZejZ
d�Zd�Zd�Z
y	)
�DOMBuilderFilterzSElement filter which can be used to tailor construction of
    a DOM instance.
    r	r%r&r'c��|jSr))�
whatToShowr+s r#�_get_whatToShowz DOMBuilderFilter._get_whatToShowBr�r"c��|jSr)��
FILTER_ACCEPT�r,�elements  r#�
acceptNodezDOMBuilderFilter.acceptNodeE����!�!�!r"c��|jSr)r�r�s  r#�startContainerzDOMBuilderFilter.startContainerHr�r"N)r
rrr
r��
FILTER_REJECT�FILTER_SKIP�FILTER_INTERRUPTr�SHOW_ALLr�r�r�r�r!r"r#r�r�1s8����M��M��K����$�$�J��"�"r"r�c�8�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�
DocumentLSz=Mixin to create documents that conform to the load/save spec.Fc��y)NFr!r+s r#�
_get_asynczDocumentLS._get_asyncSs��r"c�F�|rtjjd��y)Nz.asynchronous document loading is not supported)rDrErF)r,�flags  r#�
_set_asynczDocumentLS._set_asyncVs&����'�'�)�)�@�B�
B�r"c��td��)Nz'haven't figured out what this means yet�ryr+s r#�abortzDocumentLS.abort[s��"�5�7�	7r"c��td���Nzhaven't written this yetr�r�s  r#�loadzDocumentLS.loada���!�"<�=�=r"c��td��r�r�)r,r�s  r#�loadXMLzDocumentLS.loadXMLdr�r"c��|�|}|j	�S|j|urtjj��|j	�Sr))�
ownerDocumentrDrE�WrongDocumentErr�toxml)r,�snodes  r#�saveXMLzDocumentLS.saveXMLgsI���=��E��{�{�}���
 �
 ��
,��'�'�*�*�,�,��{�{�}�r"N)r
rrr
�async_r�r�r�r�r�rr!r"r#r�r�Ns)��G�
�F��B�
7�>�>�r"r�c�&�eZdZdZdZd�Zd�Zd�Zy)�DOMImplementationLSr	r%c���|�tjjd��||jk(r
t	�S||j
k(rtjjd��t
d��)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)rDrErF�MODE_SYNCHRONOUSr�MODE_ASYNCHRONOUSrx)r,�mode�
schemaTypes   r#�createDOMBuilderz$DOMImplementationLS.createDOMBuilderssl���!��'�'�)�)�.�0�
0��4�(�(�(��<���4�)�)�)��'�'�)�)�9�;�
;��1�2�2r"c��td��)Nz-the writer interface hasn't been written yet!r�r+s r#�createDOMWriterz#DOMImplementationLS.createDOMWriter~s��!�;�=�	=r"c��t�Sr))rr+s r#�createDOMInputSourcez(DOMImplementationLS.createDOMInputSource�s����r"N)r
rrr
rrrrr!r"r#rros������	3�=� r"r)r
rm�xml.domrD�xml.dom.NodeFilterr�__all__rrrA�objectrrr�r�rr!r"r#�<module>rst��:���)�@����@a)�a)�H*�):��):�X.�V�.�b"�"�4���B � r"

?>