+
    Tj                     L   R t ^ RItRtR t]P                  R8X  d   ^ RIt^ RIHtHtH	t	H
t
HtHtHtHtHt ^ RIHtHtHt ^ t^t^t]! ]4      ]! ]4      8w  d   ]tM]t]t ! R R]4      t ! R R	]	4      t ! R
 R]4      t]! ]4      t]
! R4      t]P<                  t]]n        ]]]]]].]n         ]PB                  t!]]!n        ]]]]].]!n         R t"R t#R#  ^ RI$t$]$P(                  t]$P*                  t]$P,                  tR t"R t#R#   ]%]&3 d    ^ ;t;ttR t"R t# R# i ; i)am  
Portable file locking utilities.

Based partially on an example by Jonathan Feignberg in the Python
Cookbook [1] (licensed under the Python Software License) and a ctypes port by
Anatoly Techtonik for Roundup [2] (license [3]).

[1] https://code.activestate.com/recipes/65203/
[2] https://sourceforge.net/p/roundup/code/ci/default/tree/roundup/backends/portalocker.py  # NOQA
[3] https://sourceforge.net/p/roundup/code/ci/default/tree/COPYING.txt

Example Usage::

    >>> from django.core.files import locks
    >>> with open('./file', 'wb') as f:
    ...     locks.lock(f, locks.LOCK_EX)
    ...     f.write('Django')
Nc                J    \        V R4      '       d   V P                  4       # T # )zCGet a filedescriptor from something which could be a file or an fd.fileno)hasattrr   fs   &L/var/www/idalgo/venv/lib/python3.14/site-packages/django/core/files/locks.py_fdr      s     H--188:414    nt)	POINTER	StructureUnionWinDLLbyrefc_int64c_ulongc_void_psizeof)BOOLDWORDHANDLEc                   &    ] tR t^:tR]3R]3.tRtR# )_OFFSETOffset
OffsetHigh N)__name__
__module____qualname____firstlineno__r   _fields___static_attributes__r   r	   r   r   r   :   s    u%e'<=r	   r   c                   ,    ] tR t^=tR.tR]3R]3.tRtR# )_OFFSET_UNION_offsetPointerr   N)	r   r   r   r   _anonymous_r   PVOIDr    r!   r   r	   r   r#   r#   =   s     k(9e*<=r	   r#   c                   8    ] tR t^AtR.tR]3R]3R]3R]3.tRt	R# )
OVERLAPPED_offset_unionInternalInternalHighhEventr   N)
r   r   r   r   r&   	ULONG_PTRr#   r   r    r!   r   r	   r   r)   r)   A   s1    &'#Y'm,v	
r	   r)   kernel32c           
          \         P                  ! \        V 4      4      p\        4       p\	        W!^ ^ R\        V4      4      p\        V4      #     l      )msvcrtget_osfhandler   r)   
LockFileExr   bool)r   flagshfile
overlappedrets   &&   r   lockr;   U   s>    $$SV,\
q!Zz9JKCyr	   c           	          \         P                  ! \        V 4      4      p\        4       p\	        V^ ^ R\        V4      4      p\        V4      # r1   )r3   r4   r   r)   UnlockFileExr   r6   )r   r8   r9   r:   s   &   r   unlockr>   [   s>    $$SV,\
5!Q
E*4EFCyr	   c                 l     \         P                  ! \        V 4      V4       R #   \         d     R# i ; i)TF)fcntlflockr   BlockingIOErrorr   r7   s   &&r   r;   r;   w   s.    CFE*" s    $ 33c                 b    \         P                  ! \        V 4      \         P                  4       R # T)r@   rA   r   LOCK_UNr   s   &r   r>   r>   ~   s    KKA.r	   c                     R # )Fr   rC   s   &&r   r;   r;   m   s    r	   c                     R # rE   r   r   s   &r   r>   r>   q   s    r	   )LOCK_EXLOCK_SHLOCK_NBr;   r>   )'__doc__os__all__r   namer3   ctypesr   r   r   r   r   r   r   r   r   ctypes.wintypesr   r   r   rJ   rK   rI   r.   r'   r   r#   r)   LPOVERLAPPEDr/   r5   restypeargtypesr=   r;   r>   r@   ImportErrorAttributeErrorr   r	   r   <module>rW      sa  & 

=5
 77d?
 
 
 43GGG g&**		E>) >> >
Y 
 :&L j!H$$JJ!5%|LJ((LL#UE5,GL------ 		- ( &''''G		s   (D
 
D#"D#