
    kh
                     V    d dl Z d dlZd dlZd dlmZ d Z G d de      Zd Zd Z	d Z
y)	    N)ZipFilec                 ,    t        t        | |            S N)_Zipr   )fileobjmodes     H/var/www/teggl/fontify/venv/lib/python3.12/site-packages/mammoth/zips.pyopen_zipr
      s    &''    c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)r   c                     || _         y r   )	_zip_file)selfzip_files     r	   __init__z_Zip.__init__   s	    !r   c                     | S r    )r   s    r	   	__enter__z_Zip.__enter__   s    r   c                 8    | j                   j                          y r   )r   close)r   argss     r	   __exit__z_Zip.__exit__   s    r   c                 ^    t        j                  | j                  j                  |            S r   )
contextlibclosingr   openr   names     r	   r   z	_Zip.open   s"    !!$.."5"5d";<<r   c                 Z    	 | j                   j                  |       y# t        $ r Y yw xY w)NTF)r   getinfoKeyErrorr   s     r	   existsz_Zip.exists   s.    	NN""4( 		s    	**c                 V    | j                   j                  |      j                  d      S )Nutf8)r   readdecoder   s     r	   read_strz_Zip.read_str    s"    ~~""4(//77r   N)	__name__
__module____qualname__r   r   r   r   r"   r'   r   r   r	   r   r      s     "=8r   r   c                 6   t        | d      }	 t        j                         }t        |d      }	 t        |j	                               t        |j                               z  }|D ]/  }||v r||   }n|j                  |      }|j                  ||       1 	 |j                          	 |j                          | j                  d       |j                  d       t        j                  ||        y # |j                          w xY w# |j                          w xY w)Nrwr   )r   ioBytesIOsetnamelistkeysr%   writestrr   seekshutilcopyfileobj)r   filessourcedestination_fileobjdestinationnamesr   contentss           r	   
update_zipr=   $   s    Wc"F jjl137		 )*S->>E 55=$T{H%{{40H$$T845 LLOQ
*G4 s#    D A'C1 D 1DD Dc                 `    | j                  dd      }t        |      dk(  rd| fS t        |      S )N/    )rsplitlentuple)pathpartss     r	   
split_pathrG   ;   s1    KKQE
5zQDzU|r   c                      t        t        d |             }g }|D ](  }|j                  d      r|g}|j                  |       * dj	                  |      S )Nr?   )listfilter
startswithappendjoin)r   non_empty_pathsrelevant_pathsrE   s       r	   	join_pathrP   C   sY    6$-.ON (??3"VN!!$'	( 88N##r   )r   r.   r5   zipfiler   r
   objectr   r=   rG   rP   r   r   r	   <module>rS      s1     	  (86 805.
$r   