← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/filelock/__pycache__/_identity.cpython-312.pyc

33 lines

�

c�bj� ���UddlmZddlZddlZddlZddlmZmZddlm	Z	ddl
mZd2d�Zd3d�Z
ejdk(�roddlZdd	lmZej"d
d��Zd
ed<ej(gej*_ej.ej*_ej2ej.ej2gej4_ej(ej4_ej(ej6ej8�ej6ej8�ej6ej8�ej6ej8�gej:_ej.ej:_dZded<dZded<dZ ded<dZ!ded<d4d�Z"d5d�Z#n�d4d�Z"ejdvrdZ$ded<d6d�Z%e%�Z&ded <d5d!�Z#nlejd"k(rYddlZddl'Z'ejPdd�#�Z)d$ed%<d&Z*ded'<d(Z+ded)<d&Z,ded*<d+Z-d,ed-<e'j\e-�Z/ded.<d5d/�Z#nd5d0�Z#gd1�Z0y)7�)�annotationsN)�EPERM�ESRCH)�Path)�Finalc�*�tj�S)zfThe hostname recorded alongside an owner, so a marker written on another machine is never probed here.)�socket�gethostname���i/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/filelock/_identity.py�	host_namers������rc�h�|t�k7ryt|�sy|�yt|�}|duxr||k7S)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_stalersD���9�;����������!�#�&�G��$��9�7�k�#9�9r�win32)�wintypes�kernel32T)�use_last_errorzFinal[ctypes.WinDLL]�	_KERNEL32iz
Final[int]�_WIN_SYNCHRONIZEi�&_WIN_PROCESS_QUERY_LIMITED_INFORMATION�W�_WIN_ERROR_INVALID_PARAMETERFzFinal[bool]�_WIN_INHERIT_HANDLEc��tjtt|�}|rtj	|�ytj�tk7S)zSWhether a process with this PID exists, treating an access denial as proof it does.T)r�OpenProcessrr �CloseHandle�ctypes�get_last_errorr)r�handles  r
rr;sA���&�&�'7�9L�c�R����!�!�&�)���$�$�&�*F�F�Frc	��tjtt|�}|syd�t	d�D�\}}}}	tj|t
j|�t
j|�t
j|�t
j|��s	tj|�y	tj|�|jdz|jzS#tj|�wxYw)zXThe process creation FILETIME as a 100ns tick count, or ``None`` when it cannot be read.Nc3�DK�|]}tj����y�w)N)r�FILETIME)�.0�_s  r
�	<genexpr>z&process_start_token.<locals>.<genexpr>Hs����6]�T\�q�x�7H�7H�7J�T\�s� �� )rr"rr �range�GetProcessTimesr$�byrefr#�dwHighDateTime�
dwLowDateTime)rr&�creation�	exit_time�kernel_time�	user_times      r
rrCs����&�&�'M�Ob�dg�h����6]�TY�Z[�T\�6]�3��)�[�)�
	*��,�,�����X�&����Y�'����[�)����Y�'����!�!�&�)��
�!�!�&�)��'�'�2�-��1G�1G�G�G��
�!�!�&�)�s�A%C)�)Dc��	tj|d�y#t$r6}|jtk(rYd}~y|jt
k(rYd}~y�d}~wwxYw)z_Whether a process with this PID exists, treating an access denial (``EPERM``) as proof it does.rNFT)�os�kill�OSError�errnorr)r�errors  r
rrXsL��	��G�G�C��O���
�	��{�{�e�#���{�{�e�#����	�s��	A�A�A�A�A>�linux�android��_STARTTIME_INDEXc��	td�jd��}t|j�j	dd�d�S#t
tf$rYywxYw)Nz/proc/sys/kernel/random/boot_id�ascii)�encoding�-��r)r�	read_text�int�strip�replacer;�
ValueError)�boot_ids r
�
_read_boot_idrNksX��
��@�A�K�K�U\�K�]���7�=�=�?�2�2�3��;�R�@�@���Z�(�
��
�s�AA�A�A�_BOOT_IDc�(�	td|�d��j�}||jd�dzdj	�}t|�tkry	t|t�}tdz|zS#t$rYywxYw#t$rYywxYw)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�lenrArIrLrO)r�data�fields�	starttimes    r
rrys���
��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_errnozFinal[ctypes.CDLL]�_LIBCrR�	_CTL_KERN��
_KERN_PROC�_KERN_PROC_PIDz<qiz
Final[str]�_TIMEVAL_AT_ZERO�
_TIMEVAL_SIZEc��tjdzttt|�}tj
d�}tj|ddtj|�dd�dk7rytj|jz�}tj|d|tj|�dd�dk7s|jtkrytjt|jd�\}}|dz|zS)zcThe process start time in microseconds from ``sysctl(KERN_PROC_PID)``, or ``None`` when it is gone.r-rNi@B)r$�c_intr^r`ra�c_size_tr]�sysctlr1�c_char�valuerc�struct�unpack_fromrb�raw)r�mib�length�buffer�seconds�microsecondss      r
rr�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)rs r
rr�s���r)rrrr)�return�str)rrIrrtr�
int | Noners�bool)rrIrsrv)rrIrsru)rsrI)1�
__future__rr9r	�sysr<rr�pathlibr�typingrrr�platformr$r�WinDLLr�__annotations__�HANDLEr#�argtypes�BOOL�restype�DWORDr"�POINTERr)r0rrrr rrrArNrOrj�CDLLr]r^r`rarb�calcsizerc�__all__rr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