ó
    ‰*£h¥  ã                   ó¦   • S r SSKrSSKJrJrJr  SSKJr  SSKJ	r	   " S S5      r
 " S S	5      r " S
 S\
5      r " S S\
5      r " S S\5      rg)zMProvides a general interface to a `physical` OPC package, such as a zip file.é    N)ÚZIP_DEFLATEDÚZipFileÚ
is_zipfile)ÚPackageNotFoundError)ÚCONTENT_TYPES_URIc                   ó,   ^ • \ rS rSrSrU 4S jrSrU =r$ )ÚPhysPkgReaderé
   z,Factory for physical package reader objects.c                 ó   >• [        U[        5      (       aP  [        R                  R	                  U5      (       a  [
        nO+[        U5      (       a  [        nO[        SU-  5      e[        n[        [        U ]/  U5      $ )NzPackage not found at '%s')Ú
isinstanceÚstrÚosÚpathÚisdirÚ_DirPkgReaderr   Ú_ZipPkgReaderr   Úsuperr	   Ú__new__)ÚclsÚpkg_fileÚ
reader_clsÚ	__class__s      €ÚN/home/mande/repo/quber/.venv/lib/python3.13/site-packages/docx/opc/phys_pkg.pyr   ÚPhysPkgReader.__new__   s`   ø€ ä�h¤×$Ñ$Ü�w‰w�}‰}˜X×&Ñ&Ü*‘
Ü˜H×%Ñ%Ü*‘
ä*Ð+FÈÑ+QÓRÐRä&ˆJä”] CÑ0°Ó<Ð<ó    © ©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__Ú__classcell__©r   s   @r   r	   r	   
   s   ø† Ù6÷=ó =r   r	   c                   ó,   ^ • \ rS rSrSrU 4S jrSrU =r$ )ÚPhysPkgWriteré   z,Factory for physical package writer objects.c                 ó2   >• [         [        U ]  [        5      $ )N)r   r'   r   Ú_ZipPkgWriter)r   r   r   s     €r   r   ÚPhysPkgWriter.__new__   s   ø€ Ü”] CÑ0´Ó?Ð?r   r   r   r%   s   @r   r'   r'      s   ø† Ù6÷@ó @r   r'   c                   óN   ^ • \ rS rSrSrU 4S jrS rS r\S 5       r	S r
SrU =r$ )	r   é#   zSImplements |PhysPkgReader| interface for an OPC package extracted into a
directory.c                 ór   >• [         [        U ]  5         [        R                  R                  U5      U l        g)zA`path` is the path to a directory containing an expanded package.N)r   r   Ú__init__r   r   ÚabspathÚ_path)Úselfr   r   s     €r   r/   Ú_DirPkgReader.__init__'   s$   ø€ äŒm˜TÑ+Ô-Ü—W‘W—_‘_ TÓ*ˆ�
r   c                 óÜ   • [         R                  R                  U R                  UR                  5      n[        US5       nUR                  5       nSSS5        U$ ! , (       d  f       W$ = f)zIReturn contents of file corresponding to `pack_uri` in package directory.ÚrbN)r   r   Újoinr1   Ú
membernameÚopenÚread)r2   Úpack_urir   ÚfÚblobs        r   Úblob_forÚ_DirPkgReader.blob_for,   sO   € ä�w‰w�|‰|˜DŸJ™J¨×(;Ñ(;Ó<ˆÜ�$˜Ô Ø—6‘6“8ˆD÷ àˆ÷ Ôàˆús   ÁAÁ
A+c                 ó   • g)ztProvides interface consistency with |ZipFileSystem|, but does nothing, a
directory file system doesn't need closing.Nr   ©r2   s    r   ÚcloseÚ_DirPkgReader.close3   s   € ð 	r   c                 ó,   • U R                  [        5      $ )z7Return the `[Content_Types].xml` blob from the package.©r=   r   r@   s    r   Úcontent_types_xmlÚ_DirPkgReader.content_types_xml8   ó   € ð �}‰}Ô.Ó/Ð/r   c                 ód   •  U R                  UR                  5      nU$ ! [         a    Sn U$ f = f)zXReturn rels item XML for source with `source_uri`, or None if the item has no
rels item.N)r=   Úrels_uriÚIOError©r2   Ú
source_uriÚrels_xmls      r   Úrels_xml_forÚ_DirPkgReader.rels_xml_for=   s=   € ð	Ø—}‘} Z×%8Ñ%8Ó9ˆHð ˆøô ó 	Ø‰HØˆð	úó   ‚ Ÿ/®/)r1   ©r   r   r    r!   r"   r/   r=   rA   ÚpropertyrE   rN   r#   r$   r%   s   @r   r   r   #   s5   ø† ñõ+ò
òð
 ñ0ó ð0÷ð r   r   c                   óN   ^ • \ rS rSrSrU 4S jrS rS r\S 5       r	S r
SrU =r$ )	r   éG   z@Implements |PhysPkgReader| interface for a zip file OPC package.c                 óL   >• [         [        U ]  5         [        US5      U l        g )NÚr)r   r   r/   r   Ú_zipf©r2   r   r   s     €r   r/   Ú_ZipPkgReader.__init__J   s   ø€ ÜŒm˜TÑ+Ô-Ü˜X sÓ+ˆ�
r   c                 óL   • U R                   R                  UR                  5      $ )zoReturn blob corresponding to `pack_uri`.

Raises |ValueError| if no matching member is present in zip archive.
)rW   r9   r7   )r2   r:   s     r   r=   Ú_ZipPkgReader.blob_forN   s   € ð
 �z‰z�‰˜x×2Ñ2Ó3Ð3r   c                 ó8   • U R                   R                  5         g)z;Close the zip archive, releasing any resources it is using.N©rW   rA   r@   s    r   rA   Ú_ZipPkgReader.closeU   s   € à�
‰
×ÑÕr   c                 ó,   • U R                  [        5      $ )z;Return the `[Content_Types].xml` blob from the zip package.rD   r@   s    r   rE   Ú_ZipPkgReader.content_types_xmlY   rG   r   c                 ód   •  U R                  UR                  5      nU$ ! [         a    Sn U$ f = f)zUReturn rels item XML for source with `source_uri` or None if no rels item is
present.N)r=   rI   ÚKeyErrorrK   s      r   rN   Ú_ZipPkgReader.rels_xml_for^   s=   € ð	Ø—}‘} Z×%8Ñ%8Ó9ˆHð ˆøô ó 	Ø‰HØˆð	úrP   ©rW   rQ   r%   s   @r   r   r   G   s3   ø† ÙJõ,ò4òð ñ0ó ð0÷ð r   r   c                   ó8   ^ • \ rS rSrSrU 4S jrS rS rSrU =r	$ )r*   éh   z@Implements |PhysPkgWriter| interface for a zip file OPC package.c                 óR   >• [         [        U ]  5         [        US[        S9U l        g )NÚw)Úcompression)r   r*   r/   r   r   rW   rX   s     €r   r/   Ú_ZipPkgWriter.__init__k   s    ø€ ÜŒm˜TÑ+Ô-Ü˜X s¼ÑEˆ�
r   c                 ó8   • U R                   R                  5         g)zcClose the zip archive, flushing any pending physical writes and releasing any
resources it's using.Nr]   r@   s    r   rA   Ú_ZipPkgWriter.closeo   s   € ð 	�
‰
×ÑÕr   c                 óP   • U R                   R                  UR                  U5        g)zQWrite `blob` to this zip package with the membername corresponding to
`pack_uri`.N)rW   Úwritestrr7   )r2   r:   r<   s      r   ÚwriteÚ_ZipPkgWriter.writet   s   € ð 	�
‰
×Ñ˜H×/Ñ/°Õ6r   rd   )
r   r   r    r!   r"   r/   rA   ro   r#   r$   r%   s   @r   r*   r*   h   s   ø† ÙJõFò÷
7ð 7r   r*   )r"   r   Úzipfiler   r   r   Údocx.opc.exceptionsr   Údocx.opc.packurir   r	   r'   r   r   r*   r   r   r   Ú<module>rt      sS   ðÙ Sã 	ß 5Ñ 5å 4Ý .÷=ñ =÷$@ñ @ô!�Mô !ôH�Mô ôB7�Mõ 7r   