ó
    Ö›‘h*  ã                   ó  • S r SSKrSSKrSSKJr  SSKJr  S rSSKJr  \R                  " 5       (       d  SSKJ
r
JrJrJr  SrOS	r SSKrSS
KJr  SrSrS r
\rS rS rS r " S S5      rS rSS/rg! \ a    Sr
 N'f = f)z&
Filesystem-based interprocess mutex.
é    N)Útime)Úplatformc                  ó@   • [        [        [        5       S-  5      5      $ )Niè  )ÚstrÚintÚ_uniquefloat© ó    Ú[C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/python/lockfile.pyÚuniquer      s   € ÜŒs”<“> DÑ(Ó)Ó*Ð*r
   )Úrename)ÚkillÚreadlinkÚremoveÚsymlinkFT)ÚOpenProcessé   éW   c                 ó  •  [        SSU 5        [        S5      e! [        R                   aS  nUR                  S   [
        :X  a   S nAg UR                  S   [        :X  a  [        [        R                  S 5      ee S nAff = f)Nr   z OpenProcess is required to fail.)
r   ÚRuntimeErrorÚ
pywintypesÚerrorÚargsÚERROR_ACCESS_DENIEDÚERROR_INVALID_PARAMETERÚOSErrorÚerrnoÚESRCH)ÚpidÚsignalÚes      r   r   r   4   ss   € ð	GÜ˜A˜q #Ô&ô #Ð#EÓFÐFøô ×#Ñ#ó Ø—6‘6˜!‘9Ô 3Ó3ÜØ—V‘V˜A‘YÔ"9Ó9Ü!¤%§+¡+¨tÓ4Ð4Øûðús   ‚ šB®A<Á
2A<Á<Bc                 ó´  • US-   [        5       -   S-   n[        R                  R                  US5      n[        R                  " U5        Sn[        X45       nUR                  U 5        UR                  5         SSS5         [        X!5        g! , (       d  f       N= f! [         a.    [        R                  " U5        [        R                  " U5        e f = f)zr
Write a file at C{filename} with the contents of C{value}. See the
above comment block as to why this is needed.
Ú.z.newlinkr   ÚwN)r   ÚosÚpathÚjoinÚmkdirÚ_openÚwriteÚflushr   ÚBaseExceptionr   Úrmdir)ÚvalueÚfilenameÚnewlinknameÚ
newvalnameÚmodeÚfs         r   r   r   E   s¤   € ð  ‘n¤v£xÑ/°*Ñ<ˆÜ—W‘W—\‘\ +¨yÓ9ˆ
Ü
�Š�Ôð ˆä�:Ô$¨Ø�G‰G�EŒNØ�G‰GŒI÷ %ð	Ü�;Õ)÷ %Õ$ûô ó 	Ü�IŠI�jÔ!Ü�HŠH�[Ô!Øð	ús   Á"BÂB Â
BÂ8Cc                 ó€  •  [        [        R                  R                  U S5      S5      nU   UR	                  5       nSSS5        U$ ! , (       d  f       W$ = f! [
         aX  nUR                  [        R                  :X  d  UR                  [        R                  :X  a  [        UR                  S5      ee SnAff = f)zY
Read the contents of C{filename}. See the above comment block as to why
this is needed.
r   ÚrN)	r)   r%   r&   r'   Úreadr   r   ÚENOENTÚEIO)r/   ÚfObjÚresultr!   s       r   r   r   `   s�   € ð
		ÜœŸ™Ÿ™ h°	Ó:¸CÓ@ˆDò ØŸ™›�÷ àˆM÷ ”àˆMûô ó 	Ø�w‰wœ%Ÿ,™,Ó&¨!¯'©'´U·Y±YÓ*>Ü˜aŸg™g tÓ,Ð,Øûð	ús#   ‚*A ®A	Á	
AÁ
B=Á%AB8Â8B=c                 ó˜   • [         R                  " [         R                  R                  U S5      5        [         R                  " U 5        g )Nr   )r%   r   r&   r'   r-   )r/   s    r   Úrmlinkr<   r   s)   € Ü
�	Š	”"—'‘'—,‘,˜x¨Ó3Ô4Ü
�Š�Õr
   c                   ó2   • \ rS rSrSrSrSrS rS rS r	Sr
g)	ÚFilesystemLockéw   aë  
A mutex.

This relies on the filesystem property that creating
a symlink is an atomic operation and that it will
fail if the symlink already exists.  Deleting the
symlink will release the lock.

@ivar name: The name of the file associated with this lock.

@ivar clean: Indicates whether this lock was released cleanly by its
    last owner.  Only meaningful after C{lock} has been called and
    returns True.

@ivar locked: Indicates whether the lock is currently held by this
    object.
NFc                 ó   • Xl         g )N)Úname)ÚselfrA   s     r   Ú__init__ÚFilesystemLock.__init__�   s   € Ø�	r
   c                 óä  • Sn  [        [        [        R                  " 5       5      U R                  5        SU l        Xl        g! [
         GaŸ  n[        (       a3  UR                  [        R                  [        R                  4;   a   SnAgUR                  [        R                  :X  Ga<   [        U R                  5      nOm! [
         a`  nUR                  [        R                  :X  a
   SnA SnAMó  [        (       a'  UR                  [        R                  :X  a	   SnA SnAge SnAff = f [        b  [        [        U5      S5        O•! [
         aˆ  nUR                  [        R                  :X  ad   [!        U R                  5        O@! [
         a3  nUR                  [        R                  :X  a   SnA SnA SnAGMÂ  e SnAff = fSn SnA SnAGMØ  e SnAff = f SnAge SnAff = f)z·
Acquire this lock.

@rtype: C{bool}
@return: True if the lock is acquired, false otherwise.

@raise OSError: Any exception L{os.symlink()} may raise,
    other than L{errno.EEXIST}.
TNFr   )r   r   r%   ÚgetpidrA   r   Ú_windowsr   ÚEACCESr8   ÚEEXISTr   r7   r   r   r   r<   ÚlockedÚclean)rB   rK   r!   r   s       r   ÚlockÚFilesystemLock.lock�   se  € ð ˆØð,ÜœœBŸIšI›KÓ(¨$¯)©)Ô4ðX ˆDŒKØŒJØøô[ ô *ß’8 §¡¬E¯L©L¼%¿)¹)Ð+DÓ Dô !Ø—7‘7œeŸl™lÔ*ðÜ& t§y¡yÓ1™øÜ"ó ØŸ7™7¤e§l¡lÓ2÷ %™Hß%šX¨!¯'©'´U·\±\Ó*A÷ $) 5ØûðúðÜÑ+Ü ¤ S£¨1Ô-ùÜ"ó ØŸ7™7¤e§k¡kÓ1ð&Ü & t§y¡yÕ 1øÜ#*ó &Ø#$§7¡7¬e¯l©lÓ#:÷ %-¦HØ %ûð&úð %*˜Eß$šHØûðúô  !ØûðU*úsÅ   …2A ÁG/Á9G*ÂG*Â.CÃG*Ã
D.ÃD)Ã,G*Ã6)D)ÄG*Ä(D)Ä)D.Ä.G*Ä2EÅG*Å
G!ÅGÅ8FÆGÆ
GÆGÆ6GÆ:G*ÇGÇGÇGÇG*ÇGÇG!Ç!G*Ç)G*Ç*G/c                 óÞ   • [        U R                  5      n[        U5      [        R                  " 5       :w  a  [        SU R                  < S35      e[        U R                  5        SU l        g)z½
Release this lock.

This deletes the directory with the given name.

@raise OSError: Any exception L{os.readlink()} may raise.
@raise ValueError: If the lock is not owned by this process.
zLock z not owned by this processFN)r   rA   r   r%   rF   Ú
ValueErrorr<   rJ   )rB   r   s     r   ÚunlockÚFilesystemLock.unlockÍ   sP   € ô �t—y‘yÓ!ˆÜˆs‹8”r—y’y“{Ó"Ü˜u T§Y¡Y¡MÐ1KÐLÓMÐMÜˆt�y‰yÔØˆ�r
   )rK   rJ   rA   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rK   rJ   rC   rL   rP   Ú__static_attributes__r	   r
   r   r>   r>   w   s#   † ñð$ €EØ€Fòò;õzr
   r>   c                 ó´   • [        U 5      nSn UR                  5       nU(       a  UR                  5         U(       + $ ! U(       a  UR                  5         f f = f)zÇ
Determine if the lock of the given name is held or not.

@type name: C{str}
@param name: The filesystem path to the lock to test

@rtype: C{bool}
@return: True if the lock is held, False otherwise.
N)r>   rL   rP   )rA   Úlr:   s      r   ÚisLockedrZ   Ý   sL   € ô 	�tÓ€AØ€FðØ—‘“ˆæØ�H‰HŒJØŒ:Ðøö Ø�H‰H�Jð ús	   �= ½ArZ   )rV   r   r%   r   r   Útwisted.python.runtimer   r   r   Ú	isWindowsr   r   r   r<   r   rG   r   Úwin32apir   r   r   ÚImportErrorÚopenr)   r>   rZ   Ú__all__r	   r
   r   Ú<module>ra      s¬   ðñó
 Û 	Ý %å +ò+õ à×Ò×Ñß<Ó<à�Hà€HðGÛÝ(ð  ÐØ"$Ðò
	Gð €Eòò6ò$÷
cñ còLð( ˜ZÐ
(�øðK ó ØŠðús   Á
A6 Á6BÂ B