;indZddlmZddlZddlZGddeZedZedZdS)z_Provides the PackURI value type. Also some useful known pack URI strings such as PACKAGE_URI. ) annotationsNceZdZdZejdZddZedd Z e dd Z e dd Z e d Z e d Ze dZddZe dZdS)PackURIzxProvides 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]*)? pack_uri_strstrcx|ddkrd}t||zt||S)Nr/z'PackURI must begin with slash, got '%s') ValueErrorr__new__)clsrtmpls DC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\docx/opc/packuri.pyr zPackURI.__new__s= ?c ! !$T**1-%0055Bwqrr{{7Brc6tj|dS)zThe "filename" portion of this pack URI, e.g. ``'slide1.xml'`` for ``'/ppt/slides/slide1.xml'``. For the package pseudo-partname '/', filename is ''. r!rrs rfilenamezPackURI.filename4rrc|j}|sdStj|d}|j|}|dS|dr"t |dSdS)zReturn 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(rr# _filename_rematchgroupint)rr( name_partr,s ridxz PackURI.idx=s| = 4&x003 !'' 22 =4 ;;q>> 'u{{1~~&& &trc|ddS)zThe 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 '/'. r!Nrs r membernamezPackURI.membernameMsABBxrcL|dkr |ddntj||S)zReturn 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'. r r!N)rrelpath)rrs rrzPackURI.relative_refVs+#c>>tABBxxy/@w/O/OOrcjd|jz}tj|jd|}t |S)zThe 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(rrrr)r rels_filename rels_uri_strs rrels_urizPackURI.rels_uri`s3"DM1  ~dlG]KK |$$$rN)rr)rrrrrr)rr)rr)__name__ __module__ __qualname____doc__recompiler+r staticmethodrpropertyrr&r(r0r3rr:r2rrrr s. 2:9::L....    \ (((X(CCCXC((X(  X XPPPP%%X%%%rrr z/[Content_Types].xml) r> __future__rrr?rr PACKAGE_URICONTENT_TYPES_URIr2rrrFs #""""" ]%]%]%]%]%c]%]%]%@gcll G233r