
    ; jg                    ~   S SK Jr  S SKrS SKrS SKJr  S SKJr  S SKJ	r	  S SK
Jr  SSKJr  SS	KJrJr  \R"                  S
:X  ak  S SKrS SKrS SKJr  SrSr\R.                  " SSS9r\R2                  /\R4                  l        \R8                  \R4                  l        SS jr " S S\5      rO " S S\5      rS/r g)    )annotationsN)suppress)EACCES)Path)cast   )BaseFileLock)ensure_directory_existsraise_on_not_writable_filewin32)wintypesi   l    kernel32T)use_last_errorc                    [         R                  U 5      nU[        :X  a$  [        R                  " 5       nUS:X  a  gUS:X  a  gg[        U[        -  5      $ )z
Check if a path is a reparse point (symlink, junction, etc.) on Windows.

:param path: Path to check

:returns: True if path is a reparse point, False otherwise

:raises OSError: If GetFileAttributesW fails for reasons other than file-not-found

   F   )	_kernel32GetFileAttributesWINVALID_FILE_ATTRIBUTESctypesget_last_errorboolFILE_ATTRIBUTE_REPARSE_POINT)pathattrserrs      b/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/filelock/_windows.py_is_reparse_pointr      sS     ,,T2++'')CaxaxE8899    c                  ,    \ rS rSrSrSS jrSS jrSrg)WindowsFileLock2   aV  
Uses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.

Lock file cleanup: Windows attempts to delete the lock file after release, but deletion is
not guaranteed in multi-threaded scenarios where another thread holds an open handle. The lock
file may persist on disk, which does not affect lock correctness.
c                   [        U R                  5        [        U R                  5        [        U R                  5      (       a  SU R                   3n[	        U5      e[
        R                  [
        R                  -  n [
        R                  " U R                  X R                  5       5      n [        R                  " U[        R                  S5        X0R                  l        g ! [         a5  n[
        R                  " U5        UR                   ["        :w  a  e  S nAg S nAff = f! [         a  nUR                   ["        :w  a  e  S nAg S nAff = f)Nz1Lock file is a reparse point (symlink/junction): r   )r   	lock_filer
   r   OSErrorosO_RDWRO_CREATopen
_open_modemsvcrtlockingLK_NBLCK_contextlock_file_fdcloseerrnor   )selfmsgflagsfd	exceptions        r   _acquireWindowsFileLock._acquire;   s    &t~~6#DNN3 !00I$..IYZcl" 		** 4WWT^^UOO4EF
4NN2v: 24MM.  HHRL &0 1  ??f, -s0   /D* 1&C( (
D'2+D""D'*
E4EEc                v   [        SU R                  R                  5      nS U R                  l        [        R                  " U[        R
                  S5        [        R                  " U5        [        [        5         [        U R                  5      R                  5         S S S 5        g ! , (       d  f       g = f)Nintr   )r   r.   r/   r+   r,   LK_UNLCKr&   r0   r   r%   r   r$   unlink)r2   r5   s     r   _releaseWindowsFileLock._releaseX   sl    eT]]778B)-DMM&NN2v2HHRL'"T^^$++- #""s   =$B**
B8 NreturnNone__name__
__module____qualname____firstlineno____doc__r7   r=   __static_attributes__r?   r   r   r!   r!   2   s    		4:	.r   r!   c                  ,    \ rS rSrSrSS jrSS jrSrg)r!   c   zWUses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.c                    [         eNNotImplementedErrorr2   s    r   r7   r8   f       %%r   c                    [         erM   rN   rP   s    r   r=   r>   i   rQ   r   r?   Nr@   rC   r?   r   r   r!   r!   c   s    e	&	&r   )r   strrA   r   )!
__future__r   r&   sys
contextlibr   r1   r   pathlibr   typingr   _apir	   _utilr
   r   platformr   r+   r   r   r   WinDLLr   LPCWSTRr   argtypesDWORDrestyper   r!   __all__r?   r   r   <module>rb      s    " 	 
      F<<7 $. ( j>I-5-=-=,>I  )+3>>I  (:.-., -.b&, & r   