§
    £”j¥  ã                   óÆ   — d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	  G d„ d¦  «        Z
 G d„ d	¦  «        Z G d
„ de
¦  «        Z G d„ de
¦  «        Z G d„ de¦  «        ZdS )zMProvides a general interface to a `physical` OPC package, such as a zip file.é    N)ÚZIP_DEFLATEDÚZipFileÚ
is_zipfile)ÚPackageNotFoundError)ÚCONTENT_TYPES_URIc                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚPhysPkgReaderz,Factory for physical package reader objects.c                 ó,  •— t          |t          ¦  «        rPt          j                             |¦  «        rt
          }n0t          |¦  «        rt          }nt          d|z  ¦  «        ‚t          }t          t          | ¦  «                             |¦  «        S )NzPackage not found at '%s')Ú
isinstanceÚstrÚosÚpathÚisdirÚ_DirPkgReaderr   Ú_ZipPkgReaderr   Úsuperr	   Ú__new__)ÚclsÚpkg_fileÚ
reader_clsÚ	__class__s      €ú`/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/docx/opc/phys_pkg.pyr   zPhysPkgReader.__new__   s‚   ø€ å�h¥Ñ$Ô$ð 	'ÝŒw�}Š}˜XÑ&Ô&ð SÝ*�
�
Ý˜HÑ%Ô%ð SÝ*�
�
å*Ð+FÈÑ+QÑRÔRÐRå&ˆJå•] CÑ(Ô(×0Ò0°Ñ<Ô<Ð<ó    ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__classcell__©r   s   @r   r	   r	   
   s>   ø€ € € € € Ø6Ð6ð=ð =ð =ð =ð =ð =ð =ð =ð =r   r	   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚPhysPkgWriterz,Factory for physical package writer objects.c                 ó^   •— t          t          | ¦  «                             t          ¦  «        S )N)r   r"   r   Ú_ZipPkgWriter)r   r   r   s     €r   r   zPhysPkgWriter.__new__   s!   ø€ Ý•] CÑ(Ô(×0Ò0µÑ?Ô?Ð?r   r   r    s   @r   r"   r"      sG   ø€ € € € € Ø6Ð6ð@ð @ð @ð @ð @ð @ð @ð @ð @r   r"   c                   óJ   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zed„ ¦   «         Zd„ Z	ˆ xZ
S )r   zWImplements |PhysPkgReader| interface for an OPC package extracted into a
    directory.c                 óž   •— t          t          | ¦  «                             ¦   «          t          j                             |¦  «        | _        dS )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'   z_DirPkgReader.__init__'   s8   ø€ å�m˜TÑ"Ô"×+Ò+Ñ-Ô-Ð-Ý”W—_’_ TÑ*Ô*ˆŒ
ˆ
ˆ
r   c                 óÒ   — t           j                             | j        |j        ¦  «        }t          |d¦  «        5 }|                     ¦   «         }ddd¦  «         n# 1 swxY w Y   |S )zIReturn contents of file corresponding to `pack_uri` in package directory.ÚrbN)r   r   Újoinr)   Ú
membernameÚopenÚread)r*   Úpack_urir   ÚfÚblobs        r   Úblob_forz_DirPkgReader.blob_for,   s�   € åŒw�|Š|˜DœJ¨Ô(;Ñ<Ô<ˆÝ�$˜ÑÔð 	 Ø—6’6‘8”8ˆDð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	àˆs   »AÁA Á#A c                 ó   — dS )z|Provides interface consistency with |ZipFileSystem|, but does nothing, a
        directory file system doesn't need closing.N© ©r*   s    r   Úclosez_DirPkgReader.close3   s	   € ð 	ˆr   c                 ó6   — |                       t          ¦  «        S )z7Return the `[Content_Types].xml` blob from the package.©r4   r   r7   s    r   Úcontent_types_xmlz_DirPkgReader.content_types_xml8   ó   € ð �}Š}Õ.Ñ/Ô/Ð/r   c                 ób   — 	 |                       |j        ¦  «        }n# t          $ r d}Y nw xY w|S )z`Return rels item XML for source with `source_uri`, or None if the item has no
        rels item.N)r4   Úrels_uriÚIOError©r*   Ú
source_uriÚrels_xmls      r   Úrels_xml_forz_DirPkgReader.rels_xml_for=   sF   € ð	Ø—}’} ZÔ%8Ñ9Ô9ˆHˆHøÝð 	ð 	ð 	ØˆHˆHˆHð	øøøàˆó   ‚ �,«,©r   r   r   r   r'   r4   r8   Úpropertyr;   rC   r   r    s   @r   r   r   #   sŠ   ø€ € € € € ðð ð+ð +ð +ð +ð +ð
ð ð ðð ð ð
 ð0ð 0ñ „Xð0ðð ð ð ð ð ð r   r   c                   óJ   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zed„ ¦   «         Zd„ Z	ˆ xZ
S )r   z@Implements |PhysPkgReader| interface for a zip file OPC package.c                 ó€   •— t          t          | ¦  «                             ¦   «          t          |d¦  «        | _        d S )NÚr)r   r   r'   r   Ú_zipf©r*   r   r   s     €r   r'   z_ZipPkgReader.__init__J   s4   ø€ Ý�m˜TÑ"Ô"×+Ò+Ñ-Ô-Ð-Ý˜X sÑ+Ô+ˆŒ
ˆ
ˆ
r   c                 ó@   — | j                              |j        ¦  «        S )zReturn blob corresponding to `pack_uri`.

        Raises |ValueError| if no matching member is present in zip archive.
        )rJ   r0   r.   )r*   r1   s     r   r4   z_ZipPkgReader.blob_forN   s   € ð
 Œz�Š˜xÔ2Ñ3Ô3Ð3r   c                 ó8   — | j                              ¦   «          dS )z;Close the zip archive, releasing any resources it is using.N©rJ   r8   r7   s    r   r8   z_ZipPkgReader.closeU   s   € àŒ
×ÒÑÔÐÐÐr   c                 ó6   — |                       t          ¦  «        S )z;Return the `[Content_Types].xml` blob from the zip package.r:   r7   s    r   r;   z_ZipPkgReader.content_types_xmlY   r<   r   c                 ób   — 	 |                       |j        ¦  «        }n# t          $ r d}Y nw xY w|S )z]Return rels item XML for source with `source_uri` or None if no rels item is
        present.N)r4   r>   ÚKeyErrorr@   s      r   rC   z_ZipPkgReader.rels_xml_for^   sF   € ð	Ø—}’} ZÔ%8Ñ9Ô9ˆHˆHøÝð 	ð 	ð 	ØˆHˆHˆHð	øøøàˆrD   rE   r    s   @r   r   r   G   s†   ø€ € € € € ØJÐJð,ð ,ð ,ð ,ð ,ð4ð 4ð 4ðð ð ð ð0ð 0ñ „Xð0ðð ð ð ð ð ð r   r   c                   ó.   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zˆ xZS )r$   z@Implements |PhysPkgWriter| interface for a zip file OPC package.c                 óŽ   •— t          t          | ¦  «                             ¦   «          t          |dt          ¬¦  «        | _        d S )NÚw)Úcompression)r   r$   r'   r   r   rJ   rK   s     €r   r'   z_ZipPkgWriter.__init__k   s9   ø€ Ý�m˜TÑ"Ô"×+Ò+Ñ-Ô-Ð-Ý˜X s½ÐEÑEÔEˆŒ
ˆ
ˆ
r   c                 ó8   — | j                              ¦   «          dS )zkClose the zip archive, flushing any pending physical writes and releasing any
        resources it's using.NrN   r7   s    r   r8   z_ZipPkgWriter.closeo   s   € ð 	Œ
×ÒÑÔÐÐÐr   c                 óF   — | j                              |j        |¦  «         dS )zYWrite `blob` to this zip package with the membername corresponding to
        `pack_uri`.N)rJ   Úwritestrr.   )r*   r1   r3   s      r   Úwritez_ZipPkgWriter.writet   s%   € ð 	Œ
×Ò˜HÔ/°Ñ6Ô6Ð6Ð6Ð6r   )r   r   r   r   r'   r8   rY   r   r    s   @r   r$   r$   h   sa   ø€ € € € € ØJÐJðFð Fð Fð Fð Fðð ð ð
7ð 7ð 7ð 7ð 7ð 7ð 7r   r$   )r   r   Úzipfiler   r   r   Údocx.opc.exceptionsr   Údocx.opc.packurir   r	   r"   r   r   r$   r6   r   r   ú<module>r]      s8  ðØ SÐ Sà 	€	€	€	Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5à 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø .Ð .Ð .Ð .Ð .Ð .ð=ð =ð =ð =ð =ñ =ô =ð =ð$@ð @ð @ð @ð @ñ @ô @ð @ð!ð !ð !ð !ð !�Mñ !ô !ð !ðHð ð ð ð �Mñ ô ð ðB7ð 7ð 7ð 7ð 7�Mñ 7ô 7ð 7ð 7ð 7r   