B
    a]                 @   s   d Z ddlmZmZmZ ddddddd	d
dddddddddZedd e D ZG dd de	Z
dd Zdd Zdd ZdS )z
Namespace-related objects.
    )absolute_importprint_functionunicode_literalsz5http://schemas.openxmlformats.org/drawingml/2006/mainz6http://schemas.openxmlformats.org/drawingml/2006/chartzGhttp://schemas.openxmlformats.org/package/2006/metadata/core-propertiesz http://purl.org/dc/elements/1.1/zhttp://purl.org/dc/dcmitype/zhttp://purl.org/dc/terms/z8http://schemas.openxmlformats.org/drawingml/2006/diagramz:http://schemas.openxmlformats.org/officeDocument/2006/mathz8http://schemas.openxmlformats.org/drawingml/2006/picturezChttp://schemas.openxmlformats.org/officeDocument/2006/relationshipsz9http://schemas.openxmlformats.org/schemaLibrary/2006/mainz<http://schemas.openxmlformats.org/wordprocessingml/2006/mainz4http://schemas.microsoft.com/office/word/2010/wordmlzFhttp://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawingz$http://www.w3.org/XML/1998/namespacez)http://www.w3.org/2001/XMLSchema-instance)acZcpZdcZdcmitypeZdctermsZdgmmZpicrslwZw14ZwpxmlZxsic             c   s   | ]\}}||fV  qd S )N ).0keyvaluer   r   >/var/www/html/venv/lib/python3.7/site-packages/docx/oxml/ns.py	<genexpr>   s    r   c                   sp   e Zd ZdZ fddZdd Zedd Zedd	 Z	ed
d Z
edd Zedd Zedd Z  ZS )NamespacePrefixedTagz\
    Value object that knows the semantics of an XML tag having a namespace
    prefix.
    c                s   t t| | |S )N)superr   __new__)clsnstagargs)	__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__c             C   s   d| j | jf S )Nz{%s}%s)r   r   )r   r   r   r   
clark_name,   s    zNamespacePrefixedTag.clark_namec             C   s.   |dd   d\}}dt| |f }| |S )N   }z%s:%s)r   pfxmap)r   r!   nsuriZ
local_namer   r   r   r   from_clark_name0   s    z$NamespacePrefixedTag.from_clark_namec             C   s   | j S )zu
        Return the local part of the tag as a string. E.g. 'foobar' is
        returned for tag 'f:foobar'.
        )r   )r   r   r   r   
local_part6   s    zNamespacePrefixedTag.local_partc             C   s   | j | jiS )z
        Return a dict having a single member, mapping the namespace prefix of
        this tag to it's namespace name (e.g. {'f': 'http://foo/bar'}). This
        is handy for passing to xpath calls and other uses.
        )r   r   )r   r   r   r   r   >   s    zNamespacePrefixedTag.nsmapc             C   s   | j S )zr
        Return the string namespace prefix for the tag, e.g. 'f' is returned
        for tag 'f:foobar'.
        )r   )r   r   r   r   nspfxG   s    zNamespacePrefixedTag.nspfxc             C   s   | j S )z
        Return the namespace URI for the tag, e.g. '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   r%   O   s    zNamespacePrefixedTag.nsuri)__name__
__module____qualname____doc__r   r    propertyr!   classmethodr&   r'   r   r(   r%   __classcell__r   r   )r   r   r       s   	r   c              G   s   d dd | D S )z
    Return a string containing a namespace declaration for each of the
    namespace prefix strings, e.g. 'p', 'ct', passed as *prefixes*.
     c             S   s   g | ]}d |t | f qS )zxmlns:%s="%s")r   )r   pfxr   r   r   
<listcomp>^   s    znsdecls.<locals>.<listcomp>)join)prefixesr   r   r   nsdeclsY   s    r5   c              G   s   t dd | D S )z
    Return a dict containing the subset namespace prefix mappings specified by
    *nspfxs*. Any number of namespace prefixes can be supplied, e.g.
    namespaces('a', 'r', 'p').
    c             s   s   | ]}|t | fV  qd S )N)r   )r   r1   r   r   r   r   g   s    znspfxmap.<locals>.<genexpr>)dict)Znspfxsr   r   r   nspfxmapa   s    r7   c             C   s"   |  d\}}t| }d||f S )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'``.
    r   z{%s}%s)r   r   )tagprefixZtagrootZurir   r   r   qnj   s    r:   N)r,   
__future__r   r   r   r   r6   itemsr$   strr   r5   r7   r:   r   r   r   r   <module>   s,   9	