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/opc/__pycache__/oxml.cpython-310.pyc
o

$we��@s0dZddlmZddlmZddlmZe��Z	ej
ddd�Ze�e	�ej
ejejd�Zd	ed
ejfdd�Zd
d�Zdd�Zdd�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Ze	�ed�Zeed <eed!<eed"<e	�ed#�Z ee d$<ee d%<d&S)'aTemporary stand-in for main oxml module.

This module came across with the PackageReader transplant. Probably much will get
replaced with objects from the pptx.oxml.core and then this module will either get
deleted or only hold the package related custom element classes.
�)�etree)�	NAMESPACE)�RELATIONSHIP_TARGET_MODETF)�remove_blank_text�resolve_entities)�ct�pr�r�text�returncCst�|t�S)z7`etree.fromstring()` replacement that uses oxml parser.)r�
fromstring�oxml_parser)r
�r�F/home/arjun/projects/env/lib/python3.10/site-packages/docx/opc/oxml.py�	parse_xmlsrcCs"|�d�\}}t|}d||fS)z�Stands for "qualified name", a utility function to turn a namespace prefixed tag
    name into a Clark-notation qualified tag name for lxml.

    For
    example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``.
    �:z{%s}%s)�split�nsmap)�tag�prefix�tagroot�urirrr�qn#srcC�tj|ddd�S)z�Serialize `part_elm` etree element to XML suitable for storage as an XML part.

    That is to say, no insignificant whitespace added for readability, and an
    appropriate XML declaration added with UTF-8 encoding specified.
    zUTF-8T)�encoding�
standalone�r�tostring)�part_elmrrr�serialize_part_xml/srcCr)z[Serialize `element` to human-readable XML suitable for tests.

    No XML declaration.
    �unicodeT)r�pretty_printr)�elementrrr�serialize_for_reading8sr#c@seZdZdZedd��ZdS)�BaseOxmlElementzhBase class for all custom element classes, to add standardized behavior to all
    classes in one place.cC�t|�S)z�Return XML string for this element, suitable for testing purposes.

        Pretty printed for readability and without an XML declaration at the top.
        )r#��selfrrr�xmlIszBaseOxmlElement.xmlN)�__name__�
__module__�__qualname__�__doc__�propertyr(rrrrr$Esr$c@s4eZdZdZedd��Zedd��Zedd��ZdS)	�
CT_Defaultzt``<Default>`` element, specifying the default content type to be applied to a
    part with the specified extension.cC�
|�d�S)zSString held in the ``ContentType`` attribute of this ``<Default>``
        element.�ContentType��getr&rrr�content_typeV�
zCT_Default.content_typecCr/)zIString held in the ``Extension`` attribute of this ``<Default>`` element.�	Extensionr1r&rrr�	extension\�
zCT_Default.extensioncC�0dtd}t|�}|�d|�|�d|�|S)zSReturn a new ``<Default>`` element with attributes set to parameter
        values.z<Default xmlns="%s"/>rr5r0�rr�set)�extr3r(�defaultrrr�newa�
zCT_Default.newN)	r)r*r+r,r-r3r6�staticmethodr=rrrrr.Rs

r.c@s4eZdZdZedd��Zedd��Zedd��ZdS)	�CT_Overridezm``<Override>`` element, specifying the content type to be applied for a part with
    the specified partname.cCr/)zTString held in the ``ContentType`` attribute of this ``<Override>``
        element.r0r1r&rrrr3pr4zCT_Override.content_typecCr8)zTReturn a new ``<Override>`` element with attributes set to parameter
        values.z<Override xmlns="%s"/>r�PartNamer0r9)�partnamer3r(�overriderrrr=vr>zCT_Override.newcCr/)zIString held in the ``PartName`` attribute of this ``<Override>`` element.rAr1r&rrrrB�r7zCT_Override.partnameN)	r)r*r+r,r-r3r?r=rBrrrrr@ls

	r@c@sReZdZdZeejfdd��Zedd��Z	edd��Z
edd	��Zed
d��ZdS)
�CT_Relationshipzb``<Relationship>`` element, representing a single relationship from a source to a
    target part.cCsTdtd}t|�}|�d|�|�d|�|�d|�|tjkr(|�dtj�|S)z(Return a new ``<Relationship>`` element.z<Relationship xmlns="%s"/>r�Id�Type�Target�
TargetMode)rrr:�RTM�EXTERNAL)�rId�reltype�target�target_moder(�relationshiprrrr=�s
zCT_Relationship.newcCr/)zGString held in the ``Id`` attribute of this ``<Relationship>`` element.rEr1r&rrrrK�r7zCT_Relationship.rIdcCr/)zIString held in the ``Type`` attribute of this ``<Relationship>`` element.rFr1r&rrrrL�r7zCT_Relationship.reltypecCr/)zSString held in the ``Target`` attribute of this ``<Relationship>``
        element.rGr1r&rrr�
target_ref�r4zCT_Relationship.target_refcCs|�dtj�S)z�String held in the ``TargetMode`` attribute of this ``<Relationship>``
        element, either ``Internal`` or ``External``.

        Defaults to ``Internal``.
        rH)r2rI�INTERNALr&rrrrN�szCT_Relationship.target_modeN)
r)r*r+r,r?rIrQr=r-rKrLrPrNrrrrrD�s


rDc@s>eZdZdZddd�Zedd��Zedd��Zed	d
��Z	dS)
�CT_Relationshipsz>``<Relationships>`` element, the root element in a .rels file.FcCs.|rtjntj}t�||||�}|�|�dS)zaAdd a child ``<Relationship>`` element with attributes set according to
        parameter values.N)rIrJrQrDr=�append)r'rKrLrM�is_externalrNrOrrr�add_rel�szCT_Relationships.add_relcC�dtd}t|�}|S)z)Return a new ``<Relationships>`` element.z<Relationships xmlns="%s"/>r�rr)r(�
relationshipsrrrr=��zCT_Relationships.newcC�|�td��S)zCReturn a list containing all the ``<Relationship>`` child elements.zpr:Relationship��findallrr&rrr�Relationship_lst�sz!CT_Relationships.Relationship_lstcCr%)z�Return XML string for this element, suitable for saving in a .rels stream,
        not pretty printed and with an XML declaration at the top.)rr&rrrr(�szCT_Relationships.xmlN)F)
r)r*r+r,rUr?r=r-r]r(rrrrrR�s


rRc@sDeZdZdZdd�Zdd�Zedd��Zedd	��Z	ed
d��Z
dS)
�CT_Typeszh``<Types>`` element, the container element for Default and Override elements in
    [Content_Types].xml.cC�t�||�}|�|�dS)zJAdd a child ``<Default>`` element with attributes set to parameter values.N)r.r=rS)r'r;r3r<rrr�add_default�szCT_Types.add_defaultcCr_)zSAdd a child ``<Override>`` element with attributes set to parameter
        values.N)r@r=rS)r'rBr3rCrrr�add_override�szCT_Types.add_overridecCrZ)Nz
ct:Defaultr[r&rrr�defaults��zCT_Types.defaultscCrV)z!Return a new ``<Types>`` element.z<Types xmlns="%s"/>rrW)r(�typesrrrr=�rYzCT_Types.newcCrZ)Nzct:Overrider[r&rrr�	overrides�rczCT_Types.overridesN)r)r*r+r,r`rar-rbr?r=rerrrrr^�s

r^r�Default�Override�Typesr�Relationship�
RelationshipsN)!r,�lxmlr�docx.opc.constantsr�NSrrI�ElementNamespaceClassLookup�element_class_lookup�	XMLParserr
�set_element_class_lookup�OPC_CONTENT_TYPES�OPC_RELATIONSHIPS�OFC_RELATIONSHIPSr�str�_Elementrrrr#�ElementBaser$r.r@rDrRr^�
get_namespace�ct_namespace�pr_namespacerrrr�<module>s8
�	

*