+
    q\i9                        ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHt ^ RIHt ^RIHt ^RIHtHt Rt^Wt ! R	 R
]4      tR
.tR# )    )annotationsN)suppress)EACCESEEXISTEPERMESRCH)Path)BaseFileLock)ensure_directory_existsraise_on_not_writable_filei   c                  v    ] tR t^tRtR R ltR R lt]R R l4       t]R R	 l4       t	R
 R lt
R R ltRtR# )SoftFileLocka  
Portable file lock based on file existence.

Unlike :class:`UnixFileLock <filelock.UnixFileLock>` and :class:`WindowsFileLock <filelock.WindowsFileLock>`, this
lock does not use OS-level locking primitives. Instead, it creates the lock file with ``O_CREAT | O_EXCL`` and
treats its existence as the lock indicator. This makes it work on any filesystem but leaves stale lock files behind
if the process crashes without releasing the lock.

To mitigate stale locks, the lock file contains the PID and hostname of the holding process. On contention, if the
holder is on the same host and its PID no longer exists, the stale lock is broken automatically.

c                   V ^8  d   QhRR/#    returnNone )formats   "f/Users/agent/.cache/uv/archive-v0/6ZL4-8mCcRNgGE9wi6M6J/lib/python3.14/site-packages/filelock/_soft.py__annotate__SoftFileLock.__annotate__    s     6 6$ 6    c                	   \        V P                  4       \        V P                  4       \        P                  \        P
                  ,          \        P                  ,          \        P                  ,          p\        \        R R4      ;pe	   W,          p \        P                  ! V P                  WP                  4       4      pV P                  V4       W0P                  n        R#   \         d   pTP                  \         8X  g,   TP                  \"        8X  d   \$        P&                  R8X  g   h TP                  \         8X  d2   \$        P&                  R8w  d   T P)                  4         Rp?R#  Rp?R#  Rp?R# Rp?ii ; i)
O_NOFOLLOWNwin32)r   	lock_filer   osO_WRONLYO_CREATO_EXCLO_TRUNCgetattropen
_open_mode_write_lock_info_contextlock_file_fdOSErrorerrnor   r   sysplatform_try_break_stale_lock)selfflags
o_nofollowfile_handler	exceptions   &    r   _acquireSoftFileLock._acquire    s   "4>>2/KKjjii jj 	 ""lD99JFE	6774>>5//:KLL !!,/)5MM&  	-6)ioo.GCLL\cLc&(S\\W-D**,, .E(	-s   /C* *F5A:FFc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   8   s     & &t &r   c                	   \        \        4      ;_uu_ 4        \        V P                  4      P	                  R R7      pVP                  4       P                  4       p\        V4      ^8w  d    RRR4       R# Vw  r4V\        P                  ! 4       8w  d    RRR4       R# \        V4      pV P                  V4      '       d    RRR4       R# V P                   R\        P                  ! 4        2p\        V P                  4      P                  V4       \        V4      P                  4        RRR4       R#   + '       g   i     R# ; i)zutf-8)encodingNz.break.)r   r)   r	   r   	read_textstrip
splitlineslensocketgethostnameint_is_process_aliver   getpidrenameunlink)r.   contentlinespid_strhostnamepid
break_paths   &      r   r-   "SoftFileLock._try_break_stale_lock8   s    g4>>*44g4FGMMO..0E5zQ	 
 !&G6--//  g,C%%c**  !NN+7299;-@J ''
3##% s   AD87D8 #D8A!D88E		c                    V ^8  d   QhRRRR/# )r   rG   r>   r   boolr   )r   s   "r   r   r   I   s      s t r   c                	   \         P                  R 8X  dd   ^ RIpVP                  P                  pVP                  \        ^ V 4      pV'       d   VP                  V4       R# VP                  4       \        8g  #  \        P                  ! V ^ 4       R#   \         d=   pTP                  \        8X  d    Rp?R# TP                  \        8X  d    Rp?R# h Rp?ii ; i)r   NTF)r+   r,   ctypeswindllkernel32OpenProcess_WIN_SYNCHRONIZECloseHandleGetLastError_WIN_ERROR_INVALID_PARAMETERr   killr)   r*   r   r   )rG   rM   rO   handleexcs   &    r   r?   SoftFileLock._is_process_aliveH   s    <<7"}}--H))*:AsCF$$V,((*.JJJ	GGCO   	yyE!yyE!	s$   :B CC9CCCc                    V ^8  d   QhRRRR/# )r   fdr>   r   r   r   )r   s   "r   r   r   ^   s     N NS NT Nr   c           	     	   \        \        4      ;_uu_ 4        \        P                  ! V \        P                  ! 4        R \
        P                  ! 4        R 2P                  4       4       RRR4       R#   + '       g   i     R# ; i)
N)r   r)   r   writer@   r<   r=   encode)rZ   s   &r   r&   SoftFileLock._write_lock_info]   sP    gHHRBIIK=6+=+=+?*@CJJLM s   AA44B	c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   b   s     . .$ .r   c                	   V P                   P                  f   Q h\        P                  ! V P                   P                  4       R V P                   n        \        P
                  R8X  d   V P                  4        R # \        \        4      ;_uu_ 4        \        V P                  4      P                  4        R R R 4       R #   + '       g   i     R # ; i)Nr   )r'   r(   r   closer+   r,   _windows_unlink_with_retryr   r)   r	   r   rB   )r.   s   &r   _releaseSoftFileLock._releaseb   s    }}))555
++,%)"<<7"++-'""T^^$++- #"""s   $CC	c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   l   s      D r   c                	V   ^
pRp\        V4       F(  p \        V P                  4      P                  4         R# 	  R#   \         d`   pTP
                  \        \        09  d    Rp? R# Y1^,
          8  d&   \        P                  ! T4       T^,          p Rp?K   Rp?K  Rp?ii ; i)
   gMbP?N)
ranger	   r   rB   r)   r*   r   r   timesleep)r.   max_retriesretry_delayattemptrW   s   &    r   rc   'SoftFileLock._windows_unlink_with_retryl   s    [)G	T^^$++-  *  %99VUO31_,JJ{+1$K -%s   #>B(	B#+,B##B(r   N)__name__
__module____qualname____firstlineno____doc__r3   r-   staticmethodr?   r&   rd   rc   __static_attributes__r   r   r   r   r      sJ    60&   ( N N. r   r   )
__future__r   r   r<   r+   rj   
contextlibr   r*   r   r   r   r   pathlibr	   _apir
   _utilr   r   rQ   rT   r   __all__r   r   r   <module>r}      sM    " 	  
   . .   F ! h< hX r   