o
    ¿Z2hÔ  ã                   @  sÈ   d Z ddlmZ ddlmZmZ i dd“dd“dd	“d
d“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“d d!“d"d#“Zd$d%„ e ¡ D ƒZG d&d'„ d'e	ƒZ
d5d+d,„Zd6d/d0„Zd7d2d3„Zd4S )8zNamespace-related objects.é    )Úannotations)ÚAnyÚDictÚaz5http://schemas.openxmlformats.org/drawingml/2006/mainÚcz6http://schemas.openxmlformats.org/drawingml/2006/chartÚcpzGhttp://schemas.openxmlformats.org/package/2006/metadata/core-propertiesÚdcz http://purl.org/dc/elements/1.1/Údcmitypezhttp://purl.org/dc/dcmitype/Údctermszhttp://purl.org/dc/terms/Údgmz8http://schemas.openxmlformats.org/drawingml/2006/diagramÚmz:http://schemas.openxmlformats.org/officeDocument/2006/mathÚpicz8http://schemas.openxmlformats.org/drawingml/2006/pictureÚrzChttp://schemas.openxmlformats.org/officeDocument/2006/relationshipsÚslz9http://schemas.openxmlformats.org/schemaLibrary/2006/mainÚwz<http://schemas.openxmlformats.org/wordprocessingml/2006/mainÚw14z4http://schemas.microsoft.com/office/word/2010/wordmlÚwpzFhttp://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawingÚxmlz$http://www.w3.org/XML/1998/namespaceÚxsiz)http://www.w3.org/2001/XMLSchema-instancec                 C  s   i | ]\}}||“qS © r   )Ú.0ÚkeyÚvaluer   r   ú]/home/skpark/git/infrasmart_work/infrasmart/venv/lib/python3.10/site-packages/docx/oxml/ns.pyÚ
<dictcomp>   ó    r   c                      s€   e Zd ZdZd‡ fdd„Zddd	„Zeddd„ƒZeddd„ƒZ	eddd„ƒZ
eddd„ƒZeddd„ƒZeddd„ƒZ‡  ZS )ÚNamespacePrefixedTagzNValue object that knows the semantics of an XML tag having a namespace prefix.ÚnstagÚstrÚargsr   c                   s   t t| ƒ | |¡S )N)Úsuperr   Ú__new__)Úclsr   r   ©Ú	__class__r   r   r!       s   zNamespacePrefixedTag.__new__c                 C  s"   |  d¡\| _| _t| j | _d S )Nú:)ÚsplitÚ_pfxÚ_local_partÚnsmapÚ_ns_uri)Úselfr   r   r   r   Ú__init__#   s   zNamespacePrefixedTag.__init__Úreturnc                 C  s   d| j | jf S )Nú{%s}%s)r*   r(   ©r+   r   r   r   Ú
clark_name'   s   zNamespacePrefixedTag.clark_namer0   c                 C  s.   |dd …   d¡\}}dt| |f }| |ƒS )Né   Ú}z%s:%s)r&   Úpfxmap)r"   r0   ÚnsuriÚ
local_namer   r   r   r   Úfrom_clark_name+   s   z$NamespacePrefixedTag.from_clark_namec                 C  ó   | j S )z[The local part of this tag.

        E.g. "foobar" is returned for tag "f:foobar".
        )r(   r/   r   r   r   Ú
local_part1   ó   zNamespacePrefixedTag.local_partúDict[str, str]c                 C  s   | j | jiS )z¼Single-member dict mapping prefix of this tag to it's namespace name.

        Example: `{"f": "http://foo/bar"}`. This is handy for passing to xpath calls
        and other uses.
        )r'   r*   r/   r   r   r   r)   9   s   zNamespacePrefixedTag.nsmapc                 C  r7   )zeThe namespace-prefix for this tag.

        For example, "f" is returned for tag "f:foobar".
        )r'   r/   r   r   r   ÚnspfxB   r9   zNamespacePrefixedTag.nspfxc                 C  r7   )z±The namespace URI for this tag.

        For example, "http://foo/bar" would be returned for tag "f:foobar" if the "f"
        prefix maps to "http://foo/bar" in nsmap.
        )r*   r/   r   r   r   r4   J   s   zNamespacePrefixedTag.nsuri)r   r   r   r   )r   r   )r-   r   )r0   r   r-   r   )r-   r:   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r,   Úpropertyr0   Úclassmethodr6   r8   r)   r;   r4   Ú__classcell__r   r   r#   r   r      s     
r   Úprefixesr   r-   c                  G  s   d  dd„ | D ƒ¡S )z—Namespace declaration including each namespace-prefix in `prefixes`.

    Handy for adding required namespace declarations to a tree root element.
    ú c                 S  s   g | ]
}d |t | f ‘qS )zxmlns:%s="%s"©r)   ©r   Úpfxr   r   r   Ú
<listcomp>Y   s    znsdecls.<locals>.<listcomp>)Újoin)rC   r   r   r   ÚnsdeclsT   s   rJ   Únspfxsr:   c                  G  s   dd„ | D ƒS )z“Subset namespace-prefix mappings specified by *nspfxs*.

    Any number of namespace prefixes can be supplied, e.g. namespaces("a", "r", "p").
    c                 S  s   i | ]}|t | “qS r   rE   rF   r   r   r   r   a   r   znspfxmap.<locals>.<dictcomp>r   )rK   r   r   r   Únspfxmap\   s   rL   Útagc                 C  s"   |   d¡\}}t| }d||f S )a  Stands for "qualified name".

    This utility function converts a familiar namespace-prefixed tag name like "w:p"
    into a Clark-notation qualified tag name for lxml. For example, `qn("w:p")` returns
    "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p".
    r%   r.   )r&   r)   )rM   ÚprefixÚtagrootÚurir   r   r   Úqnd   s   rQ   N)rC   r   r-   r   )rK   r   r-   r:   )rM   r   r-   r   )r?   Ú
__future__r   Útypingr   r   r)   Úitemsr3   r   r   rJ   rL   rQ   r   r   r   r   Ú<module>   sR    ÿþýüûúùø	÷
öõôóòñð
7
