§
    Ètºf?  ã                  ó~   — d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
mZ ddlmZ dd„Z G d„ de¦  «        ZdS )z0
Test cases covering L{twisted.python.zippath}.
é    )ÚannotationsN)ÚUnion)Ú_coerceToFilesystemEncoding)Ú
ZipArchiveÚZipPath)ÚAbstractFilePathTestsÚdirnameústr | bytesÚzfnameÚreturnÚNonec                óÀ  — t          d| ¦  «        }t          d|¦  «        }t          j        |d¦  «        5 }t          j        |¦  «        D ]y\  }}}|D ]p}t          j                             ||¦  «        }	t          j                             ||¦  «        t          | ¦  «        dz   d…         }
|                     |	|
¦  «         ŒqŒz	 ddd¦  «         dS # 1 swxY w Y   dS )zI
    Create a zipfile on zfname, containing the contents of dirname'
    Ú Úwé   N)	r   ÚzipfileÚZipFileÚosÚwalkÚpathÚjoinÚlenÚwrite)r	   r   ÚcoercedDirnameÚcoercedZfnameÚzfÚrootÚignoredÚfilesÚfnameÚfspathÚarcpaths              ú_/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/test/test_zippath.pyÚzipitr$      s,  € õ 1°°WÑ=Ô=€NÝ/°°FÑ;Ô;€Må	Œ˜¨Ñ	,Ô	,ð 	*°õ
 ŒW�^Ñ$Ô$ð		*ð 	*ñ 
ØØØàð *ð *�ÝœŸš d¨EÑ2Ô2�Ýœ'Ÿ,š, t¨UÑ3Ô3µC¸±L´LÀ1Ñ4DÐ4FÐ4FÔG�Ø—’˜ Ñ)Ô)Ð)Ð)ð*ð	*ð	*ð 	*ð 	*ñ 	*ô 	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*øøøð 	*ð 	*ð 	*ð 	*ð 	*ð 	*s   ¶BCÃCÃCc                  óP   — e Zd ZU dZded<   ded<   dd„Zdd„Zdd	„Zdd
„Zdd„Z	dS )ÚZipFilePathTestszk
    Test various L{ZipPath} path manipulations as well as reprs for L{ZipPath}
    and L{ZipArchive}.
    zZipArchive[bytes]r   r   r   r   c                ó  ‡ — t          j        ‰ ¦  «         t          ‰ j        ‰ j        dz   ¦  «         t	          d‰ j        ¦  «        ‰ _        t          ‰ j        dz   ¦  «        ‰ _        ‰ j        ‰ _        ˆ fd„‰ j	        D ¦   «         ‰ _	        d S )Nó   .zipr   c                óV   •— g | ]%}|                      ‰j        ‰j        d z   ¦  «        ‘Œ&S )r(   )ÚreplaceÚcmn)Ú.0ÚxÚselfs     €r#   ú
<listcomp>z*ZipFilePathTests.setUp.<locals>.<listcomp>4   s0   ø€ ÐNÐNÐNÀ�A—I’I˜dœh¨¬°7Ñ(:Ñ;Ô;ÐNÐNÐNó    )
r   ÚsetUpr$   r+   r   Ú	nativecmnr   r   r   Úall©r.   s   `r#   r1   zZipFilePathTests.setUp.   s€   ø€ ÝÔ# DÑ)Ô)Ð)ÝˆdŒh˜œ 7Ñ*Ñ+Ô+Ð+Ý4°R¸¼ÑBÔBˆŒÝ˜tœx¨'Ñ1Ñ2Ô2ˆŒ	Ø”IˆŒ	ØNÐNÐNÐNÀTÄXÐNÑNÔNˆŒˆˆr0   c                ó¸   — |                       | j                             d¦  «                             d¦  «        | j                             d¦  «        ¦  «         dS )zF
        L{ZipPath.sibling} returns a path at the same level.
        ÚoneÚtwoN)ÚassertEqualr   ÚchildÚsiblingr4   s    r#   Útest_siblingzZipFilePathTests.test_sibling6   sK   € ð 	×Ò˜œŸš¨Ñ/Ô/×7Ò7¸Ñ>Ô>ÀÄ	ÇÂÐPUÑ@VÔ@VÑWÔWÐWÐWÐWr0   c                ó  — | j                              d¦  «        }d                     t          j                              | j        dz   t          j        z   dz   ¦  «        ¦  «        }|                      t          |¦  «        |¦  «         | j         	                    t          j
        ¦   «         t          j        z   dd¦  «        dz   }t          |¦  «        }|                     d¦  «        }|                      t          |¦  «        |¦  «         dS )z„
        Make sure that invoking ZipPath's repr prints the correct class name
        and an absolute path to the zip file.
        ÚfoozZipPath({!r})ú.zipr   r   N)r   r9   Úformatr   Úabspathr2   Úsepr8   Úreprr*   Úgetcwdr   )r.   r9   ÚpathReprÚrelativeCommonÚrelpaths        r#   Útest_zipPathReprz!ZipFilePathTests.test_zipPathRepr<   sß   € ð
 @D¼y¿ºÈuÑ?UÔ?UˆØ"×)Ò)ÝŒG�OŠO˜DœN¨VÑ3µb´fÑ<¸uÑDÑEÔEñ
ô 
ˆð
 	×Ò�˜e™œ hÑ/Ô/Ð/ð œ×/Ò/µ´	±´½b¼fÑ0DÀbÈ!ÑLÔLÈvÑUˆÝ˜^Ñ,Ô,ˆØ—’˜eÑ$Ô$ˆð 	×Ò�˜e™œ hÑ/Ô/Ð/Ð/Ð/r0   c                ó*  — | j                              d¦  «                             d¦  «                             d¦  «        }d| j        dz   t          j                             g d¢¦  «        z   z  }|                      t          |¦  «        |¦  «         dS )z³
        The repr of a ZipPath with C{".."} in the internal part of its path
        includes the C{".."} rather than applying the usual parent directory
        meaning.
        r=   ú..ÚbarzZipPath(%r)r>   )r   r=   rI   rJ   N)r   r9   r2   r   rA   r   r8   rB   )r.   r9   rD   s      r#   Ú test_zipPathReprParentDirSegmentz1ZipFilePathTests.test_zipPathReprParentDirSegmentQ   s…   € ð ”	—’ Ñ&Ô&×,Ò,¨TÑ2Ô2×8Ò8¸Ñ?Ô?ˆØ ØŒN˜VÑ#¥b¤f§k¢kÐ2JÐ2JÐ2JÑ&KÔ&KÑKñ
ˆð 	×Ò�˜e™œ hÑ/Ô/Ð/Ð/Ð/r0   c                óÌ  — t          | j        dz   ¦  «        }d                     t          j                             | j        dz   ¦  «        ¦  «        }|                      t          |¦  «        |¦  «         | j                             t          j	        ¦   «         t          j
        z   dd¦  «        dz   }t          |¦  «        }|                      t          |¦  «        |¦  «         dS )z‡
        Make sure that invoking ZipArchive's repr prints the correct class
        name and an absolute path to the zip file.
        r>   zZipArchive({!r})r   r   N)r   r2   r?   r   r   r@   r8   rB   r*   rC   rA   )r.   r   rD   rE   rF   s        r#   Útest_zipArchiveReprz$ZipFilePathTests.test_zipArchiveRepr]   s¼   € õ
 ˜$œ.¨6Ñ1Ñ2Ô2ˆØ%×,Ò,­R¬W¯_ª_¸T¼^ÈfÑ=TÑ-UÔ-UÑVÔVˆð 	×Ò�˜d™œ XÑ.Ô.Ð.ð œ×/Ò/µ´	±´½b¼fÑ0DÀbÈ!ÑLÔLÈvÑUˆÝ˜^Ñ,Ô,ˆð 	×Ò�˜g™œ¨Ñ1Ô1Ð1Ð1Ð1r0   N)r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r1   r;   rG   rK   rM   © r0   r#   r&   r&   %   s¦   € € € € € € ðð ð
 ÐÐÑØÐÐÑðOð Oð Oð OðXð Xð Xð Xð0ð 0ð 0ð 0ð*
0ð 
0ð 
0ð 
0ð2ð 2ð 2ð 2ð 2ð 2r0   r&   )r	   r
   r   r
   r   r   )rQ   Ú
__future__r   r   r   Útypingr   Útwisted.python.filepathr   Útwisted.python.zippathr   r   Útwisted.test.test_pathsr   r$   r&   rS   r0   r#   ú<module>rY      sÖ   ððð ð #Ð "Ð "Ð "Ð "Ð "à 	€	€	€	Ø €€€Ø Ð Ð Ð Ð Ð à ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9ð*ð *ð *ð *ð&H2ð H2ð H2ð H2ð H2Ð,ñ H2ô H2ð H2ð H2ð H2r0   