§
    Ètºf‚H  ã                   ó˜   — d Z ddlZddlmZmZ ddlmZmZ ddlm	Z	 ddl
mZ  e	d¦  «        �ddlmZ ndZ G d	„ d
ej        ¦  «        ZdS )z?
Tests for the inotify wrapper in L{twisted.internet.inotify}.
é    N)ÚdeferÚreactor)ÚfilepathÚruntime)ÚrequireModule)Úunittestztwisted.python._inotify)Úinotifyc                   óò   — e Zd ZdZej                             ¦   «         sdZd„ Zd„ Z	d d„Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d„ Z#dS )!ÚINotifyTestsz]
    Define all the tests for the basic functionality exposed by
    L{inotify.INotify}.
    z&This platform doesn't support INotify.c                 ó.  — t          j        |                      ¦   «         ¦  «        | _        | j                             ¦   «          t          j        ¦   «         | _        | j                             ¦   «          |                      | j        j	        ¦  «         d S ©N)
r   ÚFilePathÚmktempÚdirnameÚcreateDirectoryr	   ÚINotifyÚstartReadingÚ
addCleanupÚloseConnection©Úselfs    úa/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/internet/test/test_inotify.pyÚsetUpzINotifyTests.setUp   sp   € ÝÔ(¨¯ª©¬Ñ7Ô7ˆŒØŒ×$Ò$Ñ&Ô&Ð&Ý”Ñ(Ô(ˆŒØŒ×!Ò!Ñ#Ô#Ð#Ø�Š˜œÔ3Ñ4Ô4Ð4Ð4Ð4ó    c                 óÆ   —  G d„ d¦  «        }|                       t          j        d |¦   «         ¦  «         |                      t          j        t          j        ¦  «         dS )a  
        L{inotify.INotify} emits a C{RuntimeError} when initialized
        in an environment that doesn't support inotify as we expect it.

        We just try to raise an exception for every possible case in
        the for loop in L{inotify.INotify._inotify__init__}.
        c                   ó   — e Zd Zd„ ZdS )ú;INotifyTests.test_initializationErrors.<locals>.FakeINotifyc                 ó(   — t          j        ¦   «         ‚r   )r	   ÚINotifyErrorr   s    r   Úinitz@INotifyTests.test_initializationErrors.<locals>.FakeINotify.init.   s   € ÝÔ*Ñ,Ô,Ð,r   N)Ú__name__Ú
__module__Ú__qualname__r    © r   r   ÚFakeINotifyr   -   s#   € € € € € ð-ð -ð -ð -ð -r   r%   Ú_inotifyN)Úpatchr	   r   ÚassertRaisesr   )r   r%   s     r   Útest_initializationErrorsz&INotifyTests.test_initializationErrors$   sk   € ð	-ð 	-ð 	-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	�
Š
•7”? J°°±´Ñ>Ô>Ð>Ø×Ò�'Ô.µ´Ñ@Ô@Ð@Ð@Ð@r   Nc                 ó  ‡ ‡‡‡— ‰€‰ j                              d¦  «        Št          j        ¦   «         Šˆˆˆ fd„}‰                     |¦  «         ‰ j                             ‰ j         ‰ˆfd„g¬¦  «          |‰¦  «         ‰S )aæ  
        Test notification from some filesystem operation.

        @param mask: The event mask to use when setting up the watch.

        @param operation: A function which will be called with the
            name of a file in the watched directory and which should
            trigger the event.

        @param expectedPath: Optionally, the name of the path which is
            expected to come back in the notification event; this will
            also be passed to C{operation} (primarily useful when the
            operation is being done to the directory itself, not a
            file in it).

        @return: A L{Deferred} which fires successfully when the
            expected event has been received or fails otherwise.
        Nzfoo.barc                 ó¸   •— | \  }}}‰                      |                     ¦   «         ‰                     ¦   «         ¦  «         ‰                     |‰z  ¦  «         d S r   )ÚassertEqualÚasBytesModeÚ
assertTrue)ÚresultÚwatchÚfilenameÚeventsÚexpectedPathÚmaskr   s       €€€r   Ú
cbNotifiedz2INotifyTests._notificationTest.<locals>.cbNotifiedK   sY   ø€ Ø(.Ñ%ˆU�H˜fØ×Ò˜X×1Ò1Ñ3Ô3°\×5MÒ5MÑ5OÔ5OÑPÔPÐPØ�OŠO˜F T™MÑ*Ô*Ð*Ð*Ð*r   c                  ó.   •— ‰                      | ¦  «        S r   ©Úcallback©ÚargsÚnotifieds    €r   ú<lambda>z0INotifyTests._notificationTest.<locals>.<lambda>S   s   ø€ ¸h×>OÒ>OÐPTÑ>UÔ>U€ r   ©r4   Ú	callbacks)r   Úchildr   ÚDeferredÚaddCallbackr	   r0   )r   r4   Ú	operationr3   r5   r;   s   `` ` @r   Ú_notificationTestzINotifyTests._notificationTest4   sµ   øøøø€ ð& ÐØœ<×-Ò-¨iÑ8Ô8ˆLÝ”>Ñ#Ô#ˆð	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð
 	×Ò˜ZÑ(Ô(Ð(àŒ×ÒØŒL˜tÐ0UÐ0UÐ0UÐ0UÐ/Vð 	ñ 	
ô 	
ð 	
ð 	ˆ	�,ÑÔÐØˆr   c                 óH   — d„ }|                       t          j        |¦  «        S )z{
        Reading from a file in a monitored directory sends an
        C{inotify.IN_ACCESS} event to the callback.
        c                 óX   — |                       d¦  «         |                      ¦   «          d S )Nó   foo)Ú
setContentÚ
getContent©Úpaths    r   rB   z+INotifyTests.test_access.<locals>.operation^   s*   € Ø�OŠO˜FÑ#Ô#Ð#Ø�OŠOÑÔÐÐÐr   )rC   r	   Ú	IN_ACCESS©r   rB   s     r   Útest_accesszINotifyTests.test_accessX   s,   € ð	ð 	ð 	ð ×%Ò%¥gÔ&7¸ÑCÔCÐCr   c                 óH   — d„ }|                       t          j        |¦  «        S )zy
        Writing to a file in a monitored directory sends an
        C{inotify.IN_MODIFY} event to the callback.
        c                 óŒ   — |                       d¦  «        5 }|                     d¦  «         d d d ¦  «         d S # 1 swxY w Y   d S )NÚwrF   )ÚopenÚwrite)rJ   ÚfObjs     r   rB   z+INotifyTests.test_modify.<locals>.operationj   s…   € Ø—’˜3‘”ð # 4Ø—
’
˜6Ñ"Ô"Ð"ð#ð #ð #ñ #ô #ð #ð #ð #ð #ð #ð #ð #øøøð #ð #ð #ð #ð #ð #s   –9¹=Á =)rC   r	   Ú	IN_MODIFYrL   s     r   Útest_modifyzINotifyTests.test_modifyd   s,   € ð	#ð 	#ð 	#ð ×%Ò%¥gÔ&7¸ÑCÔCÐCr   c                 óH   — d„ }|                       t          j        |¦  «        S )z‡
        Changing the metadata of a file in a monitored directory
        sends an C{inotify.IN_ATTRIB} event to the callback.
        c                 óV   — |                       ¦   «          |                       ¦   «          d S r   )ÚtouchrI   s    r   rB   z+INotifyTests.test_attrib.<locals>.operationv   s    € Ø�JŠJ‰LŒLˆLØ�JŠJ‰LŒLˆLˆLˆLr   )rC   r	   Ú	IN_ATTRIBrL   s     r   Útest_attribzINotifyTests.test_attribp   s,   € ð	ð 	ð 	ð ×%Ò%¥gÔ&7¸ÑCÔCÐCr   c                 óH   — d„ }|                       t          j        |¦  «        S )zž
        Closing a file which was open for writing in a monitored
        directory sends an C{inotify.IN_CLOSE_WRITE} event to the
        callback.
        c                 óT   — |                       d¦  «                             ¦   «          d S ©NrP   ©rQ   ÚcloserI   s    r   rB   z/INotifyTests.test_closeWrite.<locals>.operationƒ   ó$   € Ø�IŠI�c‰NŒN× Ò Ñ"Ô"Ð"Ð"Ð"r   )rC   r	   ÚIN_CLOSE_WRITErL   s     r   Útest_closeWritezINotifyTests.test_closeWrite|   s,   € ð	#ð 	#ð 	#ð ×%Ò%¥gÔ&<¸iÑHÔHÐHr   c                 óH   — d„ }|                       t          j        |¦  «        S )z°
        Closing a file which was open for reading but not writing in a
        monitored directory sends an C{inotify.IN_CLOSE_NOWRITE} event
        to the callback.
        c                 ó|   — |                       ¦   «          |                      d¦  «                             ¦   «          d S )NÚr)rX   rQ   r_   rI   s    r   rB   z1INotifyTests.test_closeNoWrite.<locals>.operation�   s1   € Ø�JŠJ‰LŒLˆLØ�IŠI�c‰NŒN× Ò Ñ"Ô"Ð"Ð"Ð"r   )rC   r	   ÚIN_CLOSE_NOWRITErL   s     r   Útest_closeNoWritezINotifyTests.test_closeNoWriteˆ   s,   € ð	#ð 	#ð 	#ð ×%Ò%¥gÔ&>À	ÑJÔJÐJr   c                 óH   — d„ }|                       t          j        |¦  «        S )zt
        Opening a file in a monitored directory sends an
        C{inotify.IN_OPEN} event to the callback.
        c                 óT   — |                       d¦  «                             ¦   «          d S r]   r^   rI   s    r   rB   z)INotifyTests.test_open.<locals>.operation›   r`   r   )rC   r	   ÚIN_OPENrL   s     r   Ú	test_openzINotifyTests.test_open•   s+   € ð	#ð 	#ð 	#ð ×%Ò%¥g¤o°yÑAÔAÐAr   c                 óN   ‡ — ˆ fd„}‰                       t          j        |¦  «        S )z}
        Moving a file out of a monitored directory sends an
        C{inotify.IN_MOVED_FROM} event to the callback.
        c                 óÈ   •— |                       d¦  «                             ¦   «          |                      t          j        ‰                     ¦   «         ¦  «        ¦  «         d S r]   )rQ   r_   ÚmoveTor   r   r   ©rJ   r   s    €r   rB   z.INotifyTests.test_movedFrom.<locals>.operation¦   sJ   ø€ Ø�IŠI�c‰NŒN× Ò Ñ"Ô"Ð"Ø�KŠK�Ô)¨$¯+ª+©-¬-Ñ8Ô8Ñ9Ô9Ð9Ð9Ð9r   )rC   r	   ÚIN_MOVED_FROMrL   s   ` r   Útest_movedFromzINotifyTests.test_movedFrom    s7   ø€ ð	:ð 	:ð 	:ð 	:ð 	:ð ×%Ò%¥gÔ&;¸YÑGÔGÐGr   c                 óN   ‡ — ˆ fd„}‰                       t          j        |¦  «        S )zy
        Moving a file into a monitored directory sends an
        C{inotify.IN_MOVED_TO} event to the callback.
        c                 ó¦   •— t          j        ‰                     ¦   «         ¦  «        }|                     ¦   «          |                     | ¦  «         d S r   )r   r   r   rX   rn   )rJ   Úpr   s     €r   rB   z,INotifyTests.test_movedTo.<locals>.operation²   s;   ø€ ÝÔ! $§+¢+¡-¤-Ñ0Ô0ˆAØ�GŠG‰IŒIˆIØ�HŠH�T‰NŒNˆNˆNˆNr   )rC   r	   ÚIN_MOVED_TOrL   s   ` r   Útest_movedTozINotifyTests.test_movedTo¬   s7   ø€ ð	ð 	ð 	ð 	ð 	ð
 ×%Ò%¥gÔ&9¸9ÑEÔEÐEr   c                 óH   — d„ }|                       t          j        |¦  «        S )zw
        Creating a file in a monitored directory sends an
        C{inotify.IN_CREATE} event to the callback.
        c                 óT   — |                       d¦  «                             ¦   «          d S r]   r^   rI   s    r   rB   z+INotifyTests.test_create.<locals>.operation¿   r`   r   )rC   r	   Ú	IN_CREATErL   s     r   Útest_createzINotifyTests.test_create¹   s,   € ð	#ð 	#ð 	#ð ×%Ò%¥gÔ&7¸ÑCÔCÐCr   c                 óH   — d„ }|                       t          j        |¦  «        S )zw
        Deleting a file in a monitored directory sends an
        C{inotify.IN_DELETE} event to the callback.
        c                 óV   — |                       ¦   «          |                      ¦   «          d S r   )rX   ÚremoverI   s    r   rB   z+INotifyTests.test_delete.<locals>.operationÊ   s    € Ø�JŠJ‰LŒLˆLØ�KŠK‰MŒMˆMˆMˆMr   )rC   r	   Ú	IN_DELETErL   s     r   Útest_deletezINotifyTests.test_deleteÄ   s,   € ð	ð 	ð 	ð ×%Ò%¥gÔ&7¸ÑCÔCÐCr   c                 óV   — d„ }|                       t          j        || j        ¬¦  «        S )z{
        Deleting the monitored directory itself sends an
        C{inotify.IN_DELETE_SELF} event to the callback.
        c                 ó.   — |                       ¦   «          d S r   )r}   rI   s    r   rB   z/INotifyTests.test_deleteSelf.<locals>.operationÖ   s   € Ø�KŠK‰MŒMˆMˆMˆMr   ©r3   )rC   r	   ÚIN_DELETE_SELFr   rL   s     r   Útest_deleteSelfzINotifyTests.test_deleteSelfÐ   s<   € ð	ð 	ð 	ð ×%Ò%ÝÔ" I¸D¼Lð &ñ 
ô 
ð 	
r   c                 óâ   ‡ ‡— ˆ fd„}‰ j                              ‰ j        dˆfd„g¬¦  «         t          j        ¦   «         Š‰                     |¦  «         ‰ j                             ¦   «          ‰S )z»
        Deleting the monitored directory itself sends an
        C{inotify.IN_DELETE_SELF} event to the callback
        even if the mask isn't specified by the call to watch().
        c                 óÖ   •— | \  }}}‰                      |                     ¦   «         ‰j                             ¦   «         ¦  «         ‰                     |t          j        z  ¦  «         d S r   )r,   r-   r   r.   r	   rƒ   )r/   r0   r1   r2   r   s       €r   r5   z6INotifyTests.test_deleteSelfForced.<locals>.cbNotifiedä   s_   ø€ Ø(.Ñ%ˆU�H˜fØ×Ò˜X×1Ò1Ñ3Ô3°T´\×5MÒ5MÑ5OÔ5OÑPÔPÐPØ�OŠO˜F¥WÔ%;Ñ;Ñ<Ô<Ð<Ð<Ð<r   r   c                  ó.   •— ‰                      | ¦  «        S r   r7   )r:   Úds    €r   r<   z4INotifyTests.test_deleteSelfForced.<locals>.<lambda>ê   s   ø€ ¸Q¿ZºZÈÑ=MÔ=M€ r   r=   )r	   r0   r   r   r@   rA   r}   )r   r5   rˆ   s   ` @r   Útest_deleteSelfForcedz"INotifyTests.test_deleteSelfForcedÝ   sŽ   øø€ ð	=ð 	=ð 	=ð 	=ð 	=ð
 	Œ×ÒØŒL˜sÐ/MÐ/MÐ/MÐ/MÐ.Nð 	ñ 	
ô 	
ð 	
õ ŒNÑÔˆØ	�Š�jÑ!Ô!Ð!àŒ×ÒÑÔÐØˆr   c                 ó\   ‡ — ˆ fd„}‰                       t          j        |‰ j        ¬¦  «        S )zy
        Renaming the monitored directory itself sends an
        C{inotify.IN_MOVE_SELF} event to the callback.
        c                 óz   •— |                       t          j        ‰                     ¦   «         ¦  «        ¦  «         d S r   )rn   r   r   r   ro   s    €r   rB   z-INotifyTests.test_moveSelf.<locals>.operationù   s.   ø€ Ø�KŠK�Ô)¨$¯+ª+©-¬-Ñ8Ô8Ñ9Ô9Ð9Ð9Ð9r   r‚   )rC   r	   ÚIN_MOVE_SELFr   rL   s   ` r   Útest_moveSelfzINotifyTests.test_moveSelfó   sG   ø€ ð	:ð 	:ð 	:ð 	:ð 	:ð ×%Ò%ÝÔ  )¸$¼,ð &ñ 
ô 
ð 	
r   c                 ó  ‡ ‡‡— ˆˆ ˆfd„}t           j        t           j        z  }‰ j                              ‰ j        |d|g¬¦  «         ‰ j                             d¦  «        Št          j        ¦   «         Š‰                     ¦   «          ‰S )zŒ
        L{inotify.INotify} when initialized with autoAdd==True adds
        also adds the created subdirectories to the watchlist.
        c                 ó@   •— ˆˆˆfd„}t          j        d|¦  «         d S )Nc                  óØ   •— 	 ‰                      ‰j                             ‰¦  «        ¦  «         ‰                      d ¦  «         d S # t          $ r ‰                      ¦   «          Y d S w xY wr   )r.   r	   Ú
_isWatchedr8   Ú	ExceptionÚerrback©rˆ   r   Úsubdirs   €€€r   Ú_zIINotifyTests.test_simpleSubdirectoryAutoAdd.<locals>._callback.<locals>._	  sp   ø€ ð Ø—O’O D¤L×$;Ò$;¸FÑ$CÔ$CÑDÔDÐDØ—J’J˜tÑ$Ô$Ð$Ð$Ð$øÝ ð  ð  ð  Ø—I’I‘K”K�K�K�K�Kð øøøó   ƒAA ÁA)Á(A)r   ©r   Ú	callLater)Úwpr1   r4   r–   rˆ   r   r•   s       €€€r   Ú	_callbackz>INotifyTests.test_simpleSubdirectoryAutoAdd.<locals>._callback  óA   ø€ ð ð  ð  ð  ð  ð  ð  õ Ô˜a Ñ#Ô#Ð#Ð#Ð#r   T©r4   ÚautoAddr>   Útest©	r	   ÚIN_ISDIRry   r0   r   r?   r   r@   r   ©r   r›   Ú	checkMaskrˆ   r•   s   `  @@r   Útest_simpleSubdirectoryAutoAddz+INotifyTests.test_simpleSubdirectoryAutoAdd   s¡   øøø€ ð
	$ð 
	$ð 
	$ð 
	$ð 
	$ð 
	$ð 
	$õ Ô$¥wÔ'8Ñ8ˆ	ØŒ×ÒØŒL˜y°$À9À+ð 	ñ 	
ô 	
ð 	
ð ”×#Ò# FÑ+Ô+ˆÝŒNÑÔˆØ×ÒÑ Ô Ð Øˆr   c                 ó  ‡ ‡‡‡— g Šˆˆˆ ˆfd„}t           j        t           j        z  }‰ j                              ‰ j        |d|g¬¦  «         ‰ j                             d¦  «        Št          j        ¦   «         Š‰                     ¦   «          ‰S )zz
        L{inotify.INotify} removes a directory from the watchlist when
        it's removed from the filesystem.
        c                 óª   •— ˆˆˆfd„}ˆˆˆfd„}‰s,‰                      |¦  «         t          j        d|¦  «         d S t          j        d|¦  «         d S )Nc                  óÖ   •— 	 ‰                      ‰j                             ‰¦  «        ¦  «         ‰                     ¦   «          d S # t          $ r ‰                      ¦   «          Y d S w xY wr   )r.   r	   r‘   r}   r’   r“   r”   s   €€€r   r–   zEINotifyTests.test_simpleDeleteDirectory.<locals>._callback.<locals>._%  si   ø€ ð Ø—O’O D¤L×$;Ò$;¸FÑ$CÔ$CÑDÔDÐDØ—M’M‘O”O�O�O�OøÝ ð  ð  ð  Ø—I’I‘K”K�K�K�K�Kð øøøs   ƒAA ÁA(Á'A(c                  óØ   •— 	 ‰                      ‰j                             ‰¦  «        ¦  «         ‰                      d ¦  «         d S # t          $ r ‰                      ¦   «          Y d S w xY wr   ©ÚassertFalser	   r‘   r8   r’   r“   r”   s   €€€r   Ú_ebzGINotifyTests.test_simpleDeleteDirectory.<locals>._callback.<locals>._eb,  sr   ø€ ð Ø×$Ò$ T¤\×%<Ò%<¸VÑ%DÔ%DÑEÔEÐEØ—J’J˜tÑ$Ô$Ð$Ð$Ð$øÝ ð  ð  ð  Ø—I’I‘K”K�K�K�K�Kð øøør—   r   )Úappendr   r™   )	rš   r1   r4   r–   r«   Úcallsrˆ   r   r•   s	        €€€€r   r›   z:INotifyTests.test_simpleDeleteDirectory.<locals>._callback"  s™   ø€ ð ð  ð  ð  ð  ð  ð  ð ð  ð  ð  ð  ð  ð  ð ð *à—’˜XÑ&Ô&Ð&ÝÔ! ! QÑ'Ô'Ð'Ð'Ð'õ Ô! ! SÑ)Ô)Ð)Ð)Ð)r   Tr�   rŸ   r    )r   r›   r£   r­   rˆ   r•   s   `  @@@r   Útest_simpleDeleteDirectoryz'INotifyTests.test_simpleDeleteDirectory  s®   øøøø€ ð
 ˆð	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*õ4 Ô$¥wÔ'8Ñ8ˆ	ØŒ×ÒØŒL˜y°$À9À+ð 	ñ 	
ô 	
ð 	
ð ”×#Ò# FÑ+Ô+ˆÝŒNÑÔˆØ×ÒÑ Ô Ð Øˆr   c                 óF  ‡ ‡‡— ˆˆ fd„}‰                       ‰ j                             ‰ j        t          j        ˆfd„g¬¦  «        ¦  «         t          j        ¦   «         Š‰                     |¦  «         ‰ j                             ¦   «          t          j        ¦   «         Š‰S )zš
        L{inotify.INotify} closes the file descriptor after removing a
        directory from the filesystem (and therefore from the watchlist).
        c                 ó  •— ˆˆfd„}| \  }}}‰                      |                     ¦   «         ‰j                             ¦   «         ¦  «         ‰                     |t          j        z  ¦  «         t          j        d|¦  «         d S )Nc                  ó   •— 	 ‰                      ‰j                             ‰j        ¦  «        ¦  «         ‰                      ‰j        j        ¦  «         ‰                      d ¦  «         d S # t          $ r ‰                      ¦   «          Y d S w xY wr   )rª   r	   r‘   r   Ú	connectedr8   r’   r“   )rˆ   r   s   €€r   r–   zIINotifyTests.test_deleteSelfLoseConnection.<locals>.cbNotified.<locals>._L  s�   ø€ ð Ø×$Ò$ T¤\×%<Ò%<¸T¼\Ñ%JÔ%JÑKÔKÐKØ×$Ò$ T¤\Ô%;Ñ<Ô<Ð<Ø—J’J˜tÑ$Ô$Ð$Ð$Ð$øÝ ð  ð  ð  Ø—I’I‘K”K�K�K�K�Kð øøøs   ƒA&A+ Á+BÂBr   )r,   r-   r   r.   r	   rƒ   r   r™   )r/   r–   Úignoredr1   r2   rˆ   r   s        €€r   r5   z>INotifyTests.test_deleteSelfLoseConnection.<locals>.cbNotifiedK  s’   ø€ ð ð  ð  ð  ð  ð  ð +1Ñ'ˆW�h Ø×Ò˜X×1Ò1Ñ3Ô3°T´\×5MÒ5MÑ5OÔ5OÑPÔPÐPØ�OŠO˜F¥WÔ%;Ñ;Ñ<Ô<Ð<ÝÔ˜a Ñ#Ô#Ð#Ð#Ð#r   c                  ó.   •— ‰                      | ¦  «        S r   r7   r9   s    €r   r<   z<INotifyTests.test_deleteSelfLoseConnection.<locals>.<lambda>]  s   ø€ ¨×):Ò):¸4Ñ)@Ô)@€ r   r=   )	r.   r	   r0   r   rƒ   r   r@   rA   r}   )r   r5   rˆ   r;   s   ` @@r   Útest_deleteSelfLoseConnectionz*INotifyTests.test_deleteSelfLoseConnectionE  s¸   øøø€ ð	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	�ŠØŒL×ÒØ”ÝÔ+Ø@Ð@Ð@Ð@ÐAð ñ ô ñ	
ô 	
ð 	
õ ”>Ñ#Ô#ˆØ×Ò˜ZÑ(Ô(Ð(àŒ×ÒÑÔÐÝŒNÑÔˆØˆr   c                 óN  — | j                              | j        d¬¦  «         |                      | j                              | j        ¦  «        ¦  «         | j                              | j        ¦  «         |                      | j                              | j        ¦  «        ¦  «         dS )zR
        L{inotify.INotify.ignore} removes a directory from the watchlist
        T)rž   N)r	   r0   r   r.   r‘   Úignorerª   r   s    r   Útest_ignoreDirectoryz!INotifyTests.test_ignoreDirectoryh  s‰   € ð 	Œ×Ò˜4œ<°ÐÑ6Ô6Ð6Ø�Š˜œ×/Ò/°´Ñ=Ô=Ñ>Ô>Ð>ØŒ×Ò˜DœLÑ)Ô)Ð)Ø×Ò˜œ×0Ò0°´Ñ>Ô>Ñ?Ô?Ð?Ð?Ð?r   c                 ó@  — t           j        D ]3\  }}|                      t          j        |¦  «        d         |¦  «         Œ4t           j        t           j        z  t           j        z  }|                      t          t          j        |¦  «        ¦  «        h d£¦  «         dS )zy
        L{inotify.humaReadableMask} translates all the possible event
        masks to a human readable string.
        r   >   rQ   ÚaccessÚclose_writeN)r	   Ú_FLAG_TO_HUMANr,   ÚhumanReadableMaskra   rK   rj   Úset)r   r4   Úvaluer£   s       r   Útest_humanReadableMaskz#INotifyTests.test_humanReadableMaskq  s�   € õ
 #Ô1ð 	Hð 	H‰KˆD�%Ø×Ò�WÔ6°tÑ<Ô<¸QÔ?ÀÑGÔGÐGÐGåÔ*­WÔ->Ñ>ÅÄÑPˆ	Ø×ÒÝ•Ô)¨)Ñ4Ô4Ñ5Ô5Ø-Ð-Ð-ñ	
ô 	
ð 	
ð 	
ð 	
r   c                 ó¨  — | j                              d¦  «        }|                     d¦  «        }|                     d¦  «        }|                     ¦   «          |||g}| j                             | j         d¬¦  «         | j                             | j         d¬¦  «         |D ]/}|                      | j                             |¦  «        ¦  «         Œ0dS )zŽ
        L{inotify.INotify.watch} with recursive==True will add all the
        subdirectories under the given path to the watchlist.
        rŸ   Útest2Útest3T)Ú	recursiveN)r   r?   Úmakedirsr	   r0   r.   r‘   )r   r•   Úsubdir2Úsubdir3Údirsrˆ   s         r   Útest_recursiveWatchz INotifyTests.test_recursiveWatch  sÑ   € ð
 ”×#Ò# FÑ+Ô+ˆØ—,’,˜wÑ'Ô'ˆØ—-’- Ñ(Ô(ˆØ×ÒÑÔÐØ˜ Ð)ˆØŒ×Ò˜4œ<°4ÐÑ8Ô8Ð8àŒ×Ò˜4œ<°4ÐÑ8Ô8Ð8Øð 	8ð 	8ˆAØ�OŠO˜DœL×3Ò3°AÑ6Ô6Ñ7Ô7Ð7Ð7ð	8ð 	8r   c                 ó¸   — ddl }t          j        ¦   «         }|                     |j        ¦  «         |                     ¦   «          |                      ¦   «          dS )zœ
        L{inotify.INotify.connectionLost} if there's a problem while closing
        the fd shouldn't raise the exception but should log the error
        r   N)Úosr	   r   r_   Ú_fdr   ÚflushLoggedErrors)r   rË   Úin_s      r   Útest_connectionLostErrorz%INotifyTests.test_connectionLostError�  sX   € ð
 	ˆ	ˆ	ˆ	åŒoÑÔˆØ
�Š�”ÑÔÐØ×ÒÑÔÐØ×ÒÑ Ô Ð Ð Ð r   c                 ó  ‡ ‡‡— ˆˆ ˆfd„}t           j        t           j        z  }‰ j                              ‰ j        |d|g¬¦  «         ‰ j                             d¦  «        Št          j        ¦   «         Š‰                     ¦   «          ‰S )z”
        L{inotify.INotify.watch} with autoAdd==False will stop inotify
        from watching subdirectories created under the watched one.
        c                 ó@   •— ˆˆˆfd„}t          j        d|¦  «         d S )Nc                  óØ   •— 	 ‰                      ‰j                             ‰¦  «        ¦  «         ‰                      d ¦  «         d S # t          $ r ‰                      ¦   «          Y d S w xY wr   r©   r”   s   €€€r   r–   zEINotifyTests.test_noAutoAddSubdirectory.<locals>._callback.<locals>._¤  sr   ø€ ð Ø×$Ò$ T¤\×%<Ò%<¸VÑ%DÔ%DÑEÔEÐEØ—J’J˜tÑ$Ô$Ð$Ð$Ð$øÝ ð  ð  ð  Ø—I’I‘K”K�K�K�K�Kð øøør—   r   r˜   )rš   Úfpr4   r–   rˆ   r   r•   s       €€€r   r›   z:INotifyTests.test_noAutoAddSubdirectory.<locals>._callback¡  rœ   r   Fr�   rŸ   r    r¢   s   `  @@r   Útest_noAutoAddSubdirectoryz'INotifyTests.test_noAutoAddSubdirectory›  s¡   øøø€ ð
	$ð 
	$ð 
	$ð 
	$ð 
	$ð 
	$ð 
	$õ Ô$¥wÔ'8Ñ8ˆ	ØŒ×ÒØŒL˜y°%ÀIÀ;ð 	ñ 	
ô 	
ð 	
ð ”×#Ò# FÑ+Ô+ˆÝŒNÑÔˆØ×ÒÑ Ô Ð Øˆr   c                 ó   ‡ ‡‡— ‰ j                              d¦  «        Š‰                     ¦   «          t          j        ¦   «         Šˆˆ fd„}ˆfd„}‰                      ‰ j                             ‰|g¬¦  «        ¦  «         ‰ j                             ‰¦  «         ‰                      ‰ j                             ‰t          j	        |g¬¦  «        ¦  «         ‰ 
                    |¦  «         ‰                     ¦   «          ‰S )zœ
        L{inotify.INotify} will watch a filepath for events even if the same
        path is repeatedly added/removed/re-added to the watchpoints.
        úfoo.bar2c                 óÌ   •— | \  }}}‰                      |                     ¦   «         ‰                     ¦   «         ¦  «         ‰                     |t          j        z  ¦  «         d S r   ©r,   r-   r.   r	   rƒ   )r/   r³   r1   r2   r3   r   s       €€r   r5   z<INotifyTests.test_seriesOfWatchAndIgnore.<locals>.cbNotifiedÀ  s]   ø€ Ø*0Ñ'ˆW�h Ø×Ò˜X×1Ò1Ñ3Ô3°\×5MÒ5MÑ5OÔ5OÑPÔPÐPØ�OŠO˜F¥WÔ%;Ñ;Ñ<Ô<Ð<Ð<Ð<r   c                  ó2   •— ‰                      | ¦  «         d S r   r7   r9   s    €r   ÚcallItz8INotifyTests.test_seriesOfWatchAndIgnore.<locals>.callItÅ  ó   ø€ Ø×Ò˜dÑ#Ô#Ð#Ð#Ð#r   ©r>   r=   )r   r?   rX   r   r@   r.   r	   r0   r·   rƒ   rA   r}   )r   r5   rÚ   r3   r;   s   `  @@r   Útest_seriesOfWatchAndIgnorez(INotifyTests.test_seriesOfWatchAndIgnore¶  s  øøø€ ð
 ”|×)Ò)¨*Ñ5Ô5ˆØ×ÒÑÔÐå”>Ñ#Ô#ˆð	=ð 	=ð 	=ð 	=ð 	=ð 	=ð
	$ð 	$ð 	$ð 	$ð 	$ð 	�Š˜œ×*Ò*¨<ÀFÀ8Ð*ÑLÔLÑMÔMÐMØŒ×Ò˜LÑ)Ô)Ð)Ø�ŠØŒL×ÒØ¥7Ô#9ÀfÀXð ñ ô ñ	
ô 	
ð 	
ð 	×Ò˜ZÑ(Ô(Ð(ð 	×ÒÑÔÐàˆr   c                 óš  ‡ ‡‡— ‰ j                              d¦  «        }|                     ¦   «          ‰ j                              d¦  «        Š‰                     ¦   «          t          j        ¦   «         Šˆˆ fd„}ˆfd„}‰                      ‰ j                             |t          j        |g¬¦  «        ¦  «         ‰ 	                    |¦  «         ‰                      ‰ j                             ‰t          j        |g¬¦  «        ¦  «         ‰ j         
                    |¦  «         |                     ¦   «          ‰                     ¦   «          ‰S )zr
        L{inotify.INotify} will ignore a filepath after it has been removed from
        the watch list.
        rÖ   zfoo.bar3c                 óÌ   •— | \  }}}‰                      |                     ¦   «         ‰                     ¦   «         ¦  «         ‰                     |t          j        z  ¦  «         d S r   rØ   )r/   r³   r1   r2   ÚexpectedPath2r   s       €€r   r5   z4INotifyTests.test_ignoreFilePath.<locals>.cbNotifiedç  s]   ø€ Ø*0Ñ'ˆW�h Ø×Ò˜X×1Ò1Ñ3Ô3°]×5NÒ5NÑ5PÔ5PÑQÔQÐQØ�OŠO˜F¥WÔ%;Ñ;Ñ<Ô<Ð<Ð<Ð<r   c                  ó2   •— ‰                      | ¦  «         d S r   r7   r9   s    €r   rÚ   z0INotifyTests.test_ignoreFilePath.<locals>.callItì  rÛ   r   rÜ   )r   r?   rX   r   r@   r.   r	   r0   rƒ   rA   r·   r}   )r   r3   r5   rÚ   rà   r;   s   `   @@r   Útest_ignoreFilePathz INotifyTests.test_ignoreFilePathÛ  sd  øøø€ ð
 ”|×)Ò)¨*Ñ5Ô5ˆØ×ÒÑÔÐØœ×*Ò*¨:Ñ6Ô6ˆØ×ÒÑÔÐå”>Ñ#Ô#ˆð	=ð 	=ð 	=ð 	=ð 	=ð 	=ð
	$ð 	$ð 	$ð 	$ð 	$ð 	�ŠØŒL×Ò˜|­WÔ-CÐPVÈxÐÑXÔXñ	
ô 	
ð 	
ð 	×Ò˜ZÑ(Ô(Ð(à�ŠØŒL×ÒØ�wÔ5À&Àð ñ ô ñ	
ô 	
ð 	
ð 	Œ×Ò˜LÑ)Ô)Ð)à×ÒÑÔÐØ×ÒÑÔÐàˆr   c                 ó®   — | j                              d¦  «        }|                     ¦   «          |                      t          | j        j        |¦  «         dS )zf
        L{inotify.INotify} will raise KeyError if a non-watched filepath is
        ignored.
        zfoo.ignoredN)r   r?   rX   r(   ÚKeyErrorr	   r·   )r   r3   s     r   Útest_ignoreNonWatchedFilez&INotifyTests.test_ignoreNonWatchedFile  sN   € ð
 ”|×)Ò)¨-Ñ8Ô8ˆØ×ÒÑÔÐà×Ò�( D¤LÔ$7¸ÑFÔFÐFÐFÐFr   c                 ó¸  ‡ ‡‡‡‡‡	‡
— t          ¦   «         Šˆˆˆ ˆˆˆ	ˆ
fd„}t          j        t          j        z  }‰ j                             ‰ j        |d|g¬¦  «         ‰ j                             d¦  «        Š‰                     d¦  «        Š	‰	                     d¦  «        Š
t          j        ¦   «         Š‰
 	                    ¦   «          ‰                     d¦  «        ‰	                     d¦  «        ‰
                     d	¦  «        gŠt          ‰¦  «        D ]C\  }}|                     |j                             t          j        ¦   «         ¦  «        ¦  «         ŒD‰S )
aB  
        L{inotify.INotify} with autoAdd==True for a watched path
        generates events for every file or directory already present
        in a newly created subdirectory under the watched one.

        This tests that we solve a race condition in inotify even though
        we may generate duplicate events.
        c                 ó–  •— ‰                      |¦  «         t          ‰¦  «        dk    �r	 ‰                     ‰j                             ‰¦  «        ¦  «         ‰                     ‰j                             ‰	¦  «        ¦  «         ‰                     ‰j                             ‰
¦  «        ¦  «         ‰‰‰	‰
gz   }d„ |D ¦   «         }‰                     t          ‰¦  «        t          |¦  «        ¦  «         ‰                     ‰|¦  «         ‰                     d ¦  «         d S # t          $ r ‰                     ¦   «          Y d S w xY wd S )Né   c                 ó6   — h | ]}|                      ¦   «         ’ŒS r$   )r-   )Ú.0Úfs     r   ú	<setcomp>zRINotifyTests.test_complexSubdirectoryAutoAdd.<locals>._callback.<locals>.<setcomp>  s    € Ð@Ð@Ð@°1˜qŸ}š}™œÐ@Ð@Ð@r   )	ÚaddÚlenr.   r	   r‘   r,   r8   r’   r“   )rš   r1   r4   Úcreatedr­   rˆ   r   Ú	someFilesr•   rÆ   rÇ   s       €€€€€€€r   r›   z?INotifyTests.test_complexSubdirectoryAutoAdd.<locals>._callback  s<  ø€ Ø�IŠI�hÑÔÐÝ�5‰zŒz˜QŠ‰ð%Ø—O’O D¤L×$;Ò$;¸FÑ$CÔ$CÑDÔDÐDØ—O’O D¤L×$;Ò$;¸GÑ$DÔ$DÑEÔEÐEØ—O’O D¤L×$;Ò$;¸GÑ$DÔ$DÑEÔEÐEØ'¨6°7¸GÐ*DÑD�GØ@Ð@¸Ð@Ñ@Ô@�GØ×$Ò$¥S¨¡Z¤Zµ°W±´Ñ>Ô>Ð>Ø×$Ò$ U¨GÑ4Ô4Ð4ð —J’J˜tÑ$Ô$Ð$Ð$Ð$øõ !ð  ð  ð  Ø—I’I‘K”K�K�K�K�Kð øøøð ˆs   ¬C!D$ Ä$EÅETr�   rŸ   rÂ   rÃ   z	file1.datz	file2.datz	file3.dat)r¾   r	   r¡   ry   r0   r   r?   r   r@   rÅ   Ú	enumeraterG   rJ   ÚencodeÚsysÚgetfilesystemencoding)r   r›   r£   Úir1   r­   rˆ   rð   r•   rÆ   rÇ   s   `    @@@@@@r   Útest_complexSubdirectoryAutoAddz,INotifyTests.test_complexSubdirectoryAutoAdd  sk  øøøøøøø€ õ ‘”ˆð	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%õ  Ô$¥wÔ'8Ñ8ˆ	ØŒ×ÒØŒL˜y°$À9À+ð 	ñ 	
ô 	
ð 	
ð ”×#Ò# FÑ+Ô+ˆØ—,’,˜wÑ'Ô'ˆØ—-’- Ñ(Ô(ˆÝŒNÑÔˆØ×ÒÑÔÐð �LŠL˜Ñ%Ô%Ø�MŠM˜+Ñ&Ô&Ø�MŠM˜+Ñ&Ô&ð
ˆ	õ % YÑ/Ô/ð 	Sð 	S‰KˆAˆxØ×Ò ¤× 4Ò 4µSÔ5NÑ5PÔ5PÑ QÔ QÑRÔRÐRÐRØˆr   r   )$r!   r"   r#   Ú__doc__r   ÚplatformÚsupportsINotifyÚskipr   r)   rC   rM   rU   rZ   rb   rg   rk   rq   rv   rz   r   r„   r‰   r�   r¤   r®   rµ   r¸   rÀ   rÉ   rÏ   rÔ   rÝ   râ   rå   rö   r$   r   r   r   r      s  € € € € € ðð ð
 Ô×+Ò+Ñ-Ô-ð 8Ø7ˆð5ð 5ð 5ðAð Að Að "ð "ð "ð "ðH
Dð 
Dð 
Dð
Dð 
Dð 
Dð
Dð 
Dð 
Dð
Ið 
Ið 
IðKð Kð Kð	Bð 	Bð 	Bð
Hð 
Hð 
HðFð Fð Fð	Dð 	Dð 	Dð
Dð 
Dð 
Dð
ð 
ð 
ðð ð ð,
ð 
ð 
ðð ð ð6(ð (ð (ðT!ð !ð !ðF@ð @ð @ð
ð 
ð 
ð8ð 8ð 8ð 
!ð 
!ð 
!ðð ð ð6#ð #ð #ðJ$ð $ð $ðLGð Gð Gð.ð .ð .ð .ð .r   r   )r÷   ró   Útwisted.internetr   r   Útwisted.pythonr   r   Útwisted.python.reflectr   Útwisted.trialr   r	   ÚTestCaser   r$   r   r   ú<module>r      sÚ   ððð ð €
€
€
à +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø "Ð "Ð "Ð "Ð "Ð "à€=Ð*Ñ+Ô+Ð7Ø(Ð(Ð(Ð(Ð(Ð(Ð(à€Gðeð eð eð eð e�8Ô$ñ eô eð eð eð er   