Ë
    ­Ó^jß   ã                  óœ  — U d dl mZ d dlZd dlZd dlZd dlmZmZ d dlm	Z	 d dl
mZ d2d„Zd3d„Zej                  dk(  �rod dlZd d	lmZ  ej"                  d
d¬«      Zded<   ej(                  gej*                  _        ej.                  ej*                  _        ej2                  ej.                  ej2                  gej4                  _        ej(                  ej4                  _        ej(                   ej6                  ej8                  «       ej6                  ej8                  «       ej6                  ej8                  «       ej6                  ej8                  «      gej:                  _        ej.                  ej:                  _        dZded<   dZded<   dZ ded<   dZ!ded<   d4d„Z"d5d„Z#nšd4d„Z"ej                  dv rdZ$ded<   d6d„Z% e%«       Z&ded <   d5d!„Z#nlej                  d"k(  rYd dlZd dl'Z' ejP                  dd¬#«      Z)d$ed%<   d&Z*ded'<   d(Z+ded)<   d&Z,ded*<   d+Z-d,ed-<    e'j\                  e-«      Z/ded.<   d5d/„Z#nd5d0„Z#g d1¢Z0y)7é    )ÚannotationsN)ÚEPERMÚESRCH)ÚPath)ÚFinalc                 ó*   — t        j                  «       S )zfThe hostname recorded alongside an owner, so a marker written on another machine is never probed here.)ÚsocketÚgethostname© ó    ú]/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/filelock/_identity.pyÚ	host_namer      s   € ä×ÑÓÐr   c                óh   — |t        «       k7  ryt        | «      sy|€yt        | «      }|duxr ||k7  S )a‚  
    Whether the recorded owner is provably gone, so reclaiming its marker cannot detach a live holder.

    Fail closed: return ``True`` only when this process can prove the exact recorded owner is dead. A marker from
    another host cannot be probed; a live PID whose start token still matches, or whose token cannot be read, is the
    holder or is indistinguishable from it; a live PID whose start token differs is a recycled PID, so the process that
    wrote the marker is gone. PostgreSQL, Qt ``QLockFile`` and Mercurial all break a stale lock only on proof of death
    and treat an unreadable or foreign owner as still holding.
    FTN)r   Úprocess_aliveÚprocess_start_token)ÚpidÚhostnameÚstart_tokenÚcurrents       r   Úowner_is_staler      sD   € ð ”9“;ÒØÜ˜ÔØØÐØÜ! #Ó&€GØ˜$ÐÒ9 7¨kÑ#9Ð9r   Úwin32)ÚwintypesÚkernel32T)Úuse_last_errorzFinal[ctypes.WinDLL]Ú	_KERNEL32i   z
Final[int]Ú_WIN_SYNCHRONIZEi   Ú&_WIN_PROCESS_QUERY_LIMITED_INFORMATIONéW   Ú_WIN_ERROR_INVALID_PARAMETERFzFinal[bool]Ú_WIN_INHERIT_HANDLEc                ó¦   — t         j                  t        t        | «      }|rt         j	                  |«       yt        j                  «       t        k7  S )zSWhether a process with this PID exists, treating an access denial as proof it does.T)r   ÚOpenProcessr   r    ÚCloseHandleÚctypesÚget_last_errorr   )r   Úhandles     r   r   r   ;   sA   € ä×&Ñ&Ô'7Ô9LÈcÓRˆÙÜ×!Ñ! &Ô)ØÜ×$Ñ$Ó&Ô*FÑFÐFr   c           	     ó  — t         j                  t        t        | «      }|syd„ t	        d«      D «       \  }}}}	 t         j                  |t        j                  |«      t        j                  |«      t        j                  |«      t        j                  |«      «      s	 t         j                  |«       y	 t         j                  |«       |j                  dz  |j                  z  S # t         j                  |«       w xY w)zXThe process creation FILETIME as a 100ns tick count, or ``None`` when it cannot be read.Nc              3  óD   K  — | ]  }t        j                  «       –— Œ y ­w)N)r   ÚFILETIME)Ú.0Ú_s     r   ú	<genexpr>z&process_start_token.<locals>.<genexpr>H   s   è ø€ Ò6]Èq´x×7HÑ7H×7JÑ6]ùs   ‚ é   é    )r   r"   r   r    ÚrangeÚGetProcessTimesr$   Úbyrefr#   ÚdwHighDateTimeÚdwLowDateTime)r   r&   ÚcreationÚ	exit_timeÚkernel_timeÚ	user_times         r   r   r   C   sÕ   € ä×&Ñ&Ô'MÔObÐdgÓhˆÙØÙ6]ÔTYÐZ[ÓT\Ô6]Ñ3ˆ�)˜[¨)ð
	*Ü×,Ñ,ØÜ—‘˜XÓ&Ü—‘˜YÓ'Ü—‘˜[Ó)Ü—‘˜YÓ'ôð ä×!Ñ! &Õ)ðô ×!Ñ! &Ô)Ø×'Ñ'¨2Ñ-°×1GÑ1GÑGÐGøô ×!Ñ! &Õ)ús   »A%C) Ã)D c                ó¶   — 	 t        j                  | d«       y# t        $ r6}|j                  t        k(  rY d}~y|j                  t
        k(  rY d}~y‚ d}~ww xY w)z_Whether a process with this PID exists, treating an access denial (``EPERM``) as proof it does.r   NFT)ÚosÚkillÚOSErrorÚerrnor   r   )r   Úerrors     r   r   r   X   sL   € ð	Ü�G‰G�C˜ŒOð øô ò 	Ø�{‰{œeÒ#ÜØ�{‰{œeÒ#ÜØûð	ús   ‚ ™	A¢AºAÁAÁA>   ÚlinuxÚandroidé   Ú_STARTTIME_INDEXc                 ó¸   — 	 t        d«      j                  d¬«      } t        | j                  «       j	                  dd«      d«      S # t
        t        f$ r Y yw xY w)Nz/proc/sys/kernel/random/boot_idÚascii)Úencodingú-Ú é   r   )r   Ú	read_textÚintÚstripÚreplacer;   Ú
ValueError)Úboot_ids    r   Ú_read_boot_idrN   k   sX   € ðÜÐ@ÓA×KÑKÐU\ÐKÓ]�Ü˜7Ÿ=™=›?×2Ñ2°3¸Ó;¸RÓ@Ð@øÜœZÐ(ò Ùðús   ‚AA ÁAÁAÚ_BOOT_IDc                ó(  — 	 t        d| › d�«      j                  «       }||j                  d«      dz   d j	                  «       }t        |«      t        k  ry	 t        |t           «      }t        dz  |z  S # t        $ r Y yw xY w# t        $ r Y yw xY w)zeThe ``/proc/<pid>/stat`` ``starttime`` folded with the boot id, or ``None`` when the process is gone.z/proc/z/statNó   )é   é@   )
r   Ú
read_bytesr;   ÚrfindÚsplitÚlenrA   rI   rL   rO   )r   ÚdataÚfieldsÚ	starttimes       r   r   r   y   s¦   € ðÜ˜f S E¨Ð/Ó0×;Ñ;Ó=�ð ˜$Ÿ*™* TÓ*¨QÑ.Ð0Ð1×7Ñ7Ó9ˆFÜ�6‹{Ô.Ò.ØðÜ Ô'7Ñ 8Ó9�	ô  ‘N iÑ/Ð/øô ò Ùðûô ò Ùðús#   ‚A6 ÁB Á6	BÂBÂ	BÂBÚdarwin)Ú	use_errnozFinal[ctypes.CDLL]Ú_LIBCrR   Ú	_CTL_KERNé   Ú
_KERN_PROCÚ_KERN_PROC_PIDz<qiz
Final[str]Ú_TIMEVAL_AT_ZEROÚ_TIMEVAL_SIZEc                ó  — t        j                  dz  t        t        t        | «      }t        j
                  d«      }t        j                  |ddt        j                  |«      dd«      dk7  ryt        j                  |j                  z  «       }t        j                  |d|t        j                  |«      dd«      dk7  s|j                  t        k  ryt        j                  t        |j                  d«      \  }}|dz  |z   S )zcThe process start time in microseconds from ``sysctl(KERN_PROC_PID)``, or ``None`` when it is gone.r-   r   Ni@B )r$   Úc_intr^   r`   ra   Úc_size_tr]   Úsysctlr1   Úc_charÚvaluerc   ÚstructÚunpack_fromrb   Úraw)r   ÚmibÚlengthÚbufferÚsecondsÚmicrosecondss         r   r   r   –   sÌ   € ä—<‘< !Ñ#¤Y´
¼NÈCÓPˆCÜ—_‘_ QÓ'ˆFô �|‰|˜C  D¬&¯,©,°vÓ*>ÀÀaÓHÈAÒMØÜ—m‘m f§l¡lÑ2Ó5ˆFÜ�|‰|˜C  F¬F¯L©L¸Ó,@À$ÈÓJÈaÒOÐSY×S_ÑS_ÔboÒSoØÜ$*×$6Ñ$6Ô7GÈÏÉÐUVÓ$WÑ!ˆG�\Ø˜YÑ&¨Ñ5Ð5r   c                 ó   — ~ y)z_No proven start-time source, so the owner carries no token and liveness rests on the PID alone.Nr   )r   s    r   r   r   ¦   s   € àØr   )r   r   r   r   )ÚreturnÚstr)r   rI   r   rt   r   ú
int | Noners   Úbool)r   rI   rs   rv   )r   rI   rs   ru   )rs   rI   )1Ú
__future__r   r9   r	   Úsysr<   r   r   Úpathlibr   Útypingr   r   r   Úplatformr$   r   ÚWinDLLr   Ú__annotations__ÚHANDLEr#   ÚargtypesÚBOOLÚrestypeÚDWORDr"   ÚPOINTERr)   r0   r   r   r   r    r   r   rA   rN   rO   rj   ÚCDLLr]   r^   r`   ra   rb   Úcalcsizerc   Ú__all__r   r   r   ú<module>r‡      s  ðÞ "ã 	Û Û 
ß Ý Ý ó ó
:ð( ‡<�<�7ÓÛÝà&3 f§m¡m°JÈtÔ&T€IÐ#ÓTØ&.§o¡oÐ%6€I×ÑÔ"Ø$,§M¡M€I×ÑÔ!Ø&.§n¡n°h·m±mÀXÇ^Á^Ð%T€I×ÑÔ"Ø$,§O¡O€I×ÑÔ!à�‰Øˆ�‰�x×(Ñ(Ó)Øˆ�‰�x×(Ñ(Ó)Øˆ�‰�x×(Ñ(Ó)Øˆ�‰�x×(Ñ(Ó)ð*€I×ÑÔ&ð )1¯©€I×ÑÔ%à#+Ð�jÓ+Ø9?Ð*¨JÓ?Ø/1Ð  *Ó1Ø',Ð˜Ó,óGôHó*
ð ‡|�|Ð+Ñ+ð
 (*Ð˜*Ó)ó
	ñ  -›ˆ�*Ó.ô	0ð  
�‰˜Ò	!ÛÛà$/ F§K¡K°ÀÔ$EˆÐ!ÓEØ !ˆ	�:Ó!Ø!#ˆ
�JÓ#Ø%&ˆ˜
Ó&ð (-Ð˜*Ó,Ø$3 F§O¡OÐ4DÓ$Eˆ�zÓEô	6ó 	ò�r   