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__/packuri.cpython-310.pyc
o

$we|�@s8dZddlZddlZGdd�de�Zed�Zed�ZdS)z_Provides the PackURI value type.

Also some useful known pack URI strings such as PACKAGE_URI.
�Nc@s~eZdZdZe�d�Zdd�Zedd��Z	e
dd��Ze
d	d
��Ze
dd��Z
e
d
d��Ze
dd��Zdd�Ze
dd��ZdS)�PackURIz|Provides access to pack URI components such as the baseURI and the filename
    slice.

    Behaves as |str| otherwise.
    z([a-zA-Z]+)([1-9][0-9]*)?cCs(|ddkrd}t||��t�||�S)Nr�/z'PackURI must begin with slash, got '%s')�
ValueError�str�__new__)�cls�pack_uri_str�tmpl�r
�I/home/arjun/projects/env/lib/python3.10/site-packages/docx/opc/packuri.pyrszPackURI.__new__cCst�||�}t�|�}t|�S)zyReturn a |PackURI| instance containing the absolute pack URI formed by
        translating `relative_ref` onto `baseURI`.)�	posixpath�join�abspathr)�baseURI�relative_ref�
joined_uri�abs_urir
r
r�from_rel_refs
zPackURI.from_rel_refcC�t�|�dS)z�The base URI of this pack URI, the directory portion, roughly speaking.

        E.g. ``'/ppt/slides'`` for ``'/ppt/slides/slide1.xml'``. For the package pseudo-
        partname '/', baseURI is '/'.
        r�r�split��selfr
r
rr!�zPackURI.baseURIcCs(t�|�d}|�d�r|dd�S|S)z�The extension portion of this pack URI, e.g. ``'xml'`` for
        ``'/word/document.xml'``.

        Note the period is not included.
        ��.N)r�splitext�
startswith)r�raw_extr
r
r�ext*szPackURI.extcCr)z�The "filename" portion of this pack URI, e.g. ``'slide1.xml'`` for
        ``'/ppt/slides/slide1.xml'``.

        For the package pseudo-partname '/', filename is ''.
        rrrr
r
r�filename5rzPackURI.filenamecCsP|j}|sdSt�|�d}|j�|�}|durdS|�d�r&t|�d��SdS)z�Return partname index as integer for tuple partname or None for singleton
        partname, e.g. ``21`` for ``'/ppt/slides/slide21.xml'`` and |None| for
        ``'/ppt/presentation.xml'``.Nr�)r rr�_filename_re�match�group�int)rr �	name_partr#r
r
r�idx>s
zPackURI.idxcCs|dd�S)z�The pack URI with the leading slash stripped off, the form used as the Zip
        file membername for the package item.

        Returns '' for the package pseudo-partname '/'.
        rNr
rr
r
r�
membernameNszPackURI.membernamecCs |dkr
|dd�St�||�S)z�Return string containing relative reference to package item from `baseURI`.

        E.g. PackURI('/ppt/slideLayouts/slideLayout1.xml') would return
        '../slideLayouts/slideLayout1.xml' for baseURI '/ppt/slides'.
        rrN)r�relpath)rrr
r
rrWs zPackURI.relative_refcCs"d|j}t�|jd|�}t|�S)z�The pack URI of the .rels part corresponding to the current pack URI.

        Only produces sensible output if the pack URI is a partname or the package
        pseudo-partname '/'.
        z%s.rels�_rels)r rr
rr)r�
rels_filename�rels_uri_strr
r
r�rels_urias
zPackURI.rels_uriN)�__name__�
__module__�__qualname__�__doc__�re�compiler"r�staticmethodr�propertyrrr r'r(rr-r
r
r
rr
s&








rrz/[Content_Types].xml)r1rr2rr�PACKAGE_URI�CONTENT_TYPES_URIr
r
r
r�<module>sc