HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/docx/oxml/__pycache__/parser.cpython-310.pyc
o

$we��@s�dZddlmZddlmZmZmZmZddlm	Z	ddl
mZmZer*ddl
mZe	��Ze	jddd	�Ze�e�ddd�Zddd�Z		dd dd�ZdS)!zXML parser for python-docx.�)�annotations)�
TYPE_CHECKING�Dict�Type�cast)�etree)�NamespacePrefixedTag�nsmap)�BaseOxmlElementTF)�remove_blank_text�resolve_entities�xml�str�return�'BaseOxmlElement'cCstdt�|t��S)z�Root lxml element obtained by parsing XML character string `xml`.

    The custom parser is used, so custom element classes are produced for elements in
    `xml` that have them.
    r
)rr�
fromstring�oxml_parser)r
�r�I/home/arjun/projects/env/lib/python3.10/site-packages/docx/oxml/parser.py�	parse_xmlsr�tag�cls�Type['BaseOxmlElement']cCs(|�d�\}}t�t|�}|||<dS)z�Register an lxml custom element-class to use for `tag`.

    A instance of `cls` to be constructed when the oxml parser encounters an element
    with matching `tag`. `tag` is a string of the form `nspfx:tagroot`, e.g.
    `'w:document'`.
    �:N)�split�element_class_lookup�
get_namespacer	)rr�nspfx�tagroot�	namespacerrr�register_element_clssr N�
nsptag_str�attrs�Dict[str, str] | None�nsdeclsr
cCs(t|�}|dur|j}tj|j||d�S)alReturn a 'loose' lxml element having the tag specified by `nsptag_str`.

    The tag in `nsptag_str` must contain the standard namespace prefix, e.g. `a:tbl`.
    The resulting element is an instance of the custom element class for this tag name
    if one is defined. A dictionary of attribute values may be provided as `attrs`; they
    are set if present. All namespaces defined in the dict `nsdecls` are declared in the
    element using the key as the prefix and the value as the namespace name. If
    `nsdecls` is not provided, a single namespace declaration is added based on the
    prefix on `nsptag_str`.
    N)�attribr	)rr	r�makeelement�
clark_name)r!r"r$�nsptagrrr�OxmlElement*sr))r
rrr)rrrr)NN)r!rr"r#r$r#rr
)�__doc__�
__future__r�typingrrrr�lxmlr�docx.oxml.nsrr	�docx.oxml.xmlchemyr
�ElementNamespaceClassLookupr�	XMLParserr�set_element_class_lookuprr r)rrrr�<module>s


	�