
    ~Zi                    Z    S r SSKJr  SSKrSSKr " S S\5      r\" S5      r\" S5      rg)zOProvides the PackURI value type and known pack-URI strings such as PACKAGE_URI.    )annotationsNc                      \ rS rSrSr\R                  " S5      rSS jr\	SS j5       r
\SS j5       r\SS j5       r\SS j5       r\SS	 j5       r\SS
 j5       rSS jr\SS j5       rSrg)PackURI	   z~Proxy for a pack URI (partname).

Provides utility properties the baseURI and the filename slice. Behaves as |str| otherwise.
z([a-zA-Z]+)([0-9][0-9]*)?c                l    US   S:X  d  [        S[        U5       35      e[        R                  X5      $ )Nr   /z#PackURI must begin with slash, got )
ValueErrorreprstr__new__)clspack_uri_strs     j/var/www/eduai.edurigo.com/question_generate/ques_gen_env/lib/python3.13/site-packages/pptx/opc/packuri.pyr   PackURI.__new__   s6    A#%B4CUBVWXX{{3--    c                p    [         R                  " X5      n[         R                  " U5      n[        U5      $ )zSConstruct an absolute pack URI formed by translating `relative_ref` onto `baseURI`.)	posixpathjoinabspathr   )baseURIrelative_ref
joined_uriabs_uris       r   from_rel_refPackURI.from_rel_ref   s-     ^^G:
##J/wr   c                4    [         R                  " U 5      S   $ )zThe 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 "/", the baseURI is "/".
r   r   splitselfs    r   r   PackURI.baseURI        t$Q''r   c                n    [         R                  " U 5      S   nUR                  S5      (       a  USS $ U$ )zThe extension portion of this pack URI.

E.g. `"xml"` for `"/ppt/slides/slide1.xml"`. Note the leading period is not included.
   .N)r   splitext
startswith)r    raw_exts     r   extPackURI.ext'   s:     $$T*1-%0055wqr{B7Br   c                4    [         R                  " U 5      S   $ )zThe "filename" portion of this pack URI.

E.g. `"slide1.xml"` for `"/ppt/slides/slide1.xml"`.

For the package pseudo-partname "/", `filename` is ''.
r$   r   r   s    r   filenamePackURI.filename1   r"   r   c                    U R                   nU(       d  g[        R                  " U5      S   nU R                  R	                  U5      nUc  gUR                  S5      (       a  [        UR                  S5      5      $ g)zOptional int partname index.

Value is an integer for an "array" 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)r    r,   	name_partr1   s       r   idxPackURI.idx;   si     ==&&x03	!!''	2=;;q>>u{{1~&&r   c                    U SS $ )zThe pack URI with the leading slash stripped off.

This is the form used as the Zip file membername for the package item. Returns "" for the
package pseudo-partname "/".
r$   N r   s    r   
membernamePackURI.membernameM   s     ABxr   c                D    US:X  a  U SS $ [         R                  " X5      $ )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)r   relpath)r    r   s     r   r   PackURI.relative_refV   s&     #c>tABxOy/@/@/OOr   c                z    SU R                   -  n[        R                  " U R                  SU5      n[	        U5      $ )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,   r   r   r   r   )r    rels_filenamerels_uri_strs      r   rels_uriPackURI.rels_uri`   s3     "DMM1 ~~dllG]K|$$r   r8   N)r   r   )r   r   r   r   returnr   )rD   r   )rD   z
int | None)r   r   rD   r   )rD   r   )__name__
__module____qualname____firstlineno____doc__recompiler0   r   staticmethodr   propertyr   r)   r,   r5   r9   r   rB   __static_attributes__r8   r   r   r   r   	   s    
 ::9:L.
     ( ( C C ( (  "  P % %r   r   r   z/[Content_Types].xml)	rI   
__future__r   r   rJ   r   r   PACKAGE_URICONTENT_TYPES_URIr8   r   r   <module>rR      s7    U "  	`%c `%F cl23 r   