/opt/imunify360/venv/lib/python3.11/site-packages/lockfile/__pycache__
Edit: /opt/imunify360/venv/lib/python3.11/site-packages/lockfile/__pycache__/pidlockfile.cpython-311.pyc (7324B)
§
£/Õ˜ónã ó| — d Z ddlmZ ddlZddlZddlZddlmZmZm Z m
Z
mZmZ G d„ de¦ « Z
d„ Zd „ Zd
„ ZdS )z8 Lockfile behaviour implemented via Unix PID files.
é )Úabsolute_importNé )ÚLockBaseÚ
AlreadyLockedÚ
LockFailedÚ NotLockedÚ NotMyLockÚLockTimeoutc ó@ — e Zd ZdZdd„Zd„ Zd„ Zd„ Zdd„Zd „ Z d
„ Z
dS )
ÚPIDLockFileaA Lockfile implemented as a Unix PID file.
The lock file is a normal file named by the attribute `path`.
A lock's PID file contains a single line of text, containing
the process ID (PID) of the process that acquired the lock.
>>> lock = PIDLockFile('somefile')
>>> lock = PIDLockFile('somefile')
FNc óL — t j | |d|¦ « | j | _ d S )NF)r Ú__init__ÚpathÚunique_name)Úselfr ÚthreadedÚtimeouts út/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/lockfile/pidlockfile.pyr zPIDLockFile.__init__$ s+ € õ Ô˜$ e¨WÑ5Ô5Ð5Øœ9ˆÔÐÐó c ó* — t | j ¦ « S )z- Get the PID from the lock file.
)Úread_pid_from_pidfiler ©r s r Úread_pidzPIDLockFile.read_pid* s € õ % T¤YÑ/Ô/Ð/r c óJ — t j | j ¦ « S )zv Test if the lock is currently held.
The lock is held if the PID file for this lock exists.
)Úosr Úexistsr s r Ú is_lockedzPIDLockFile.is_locked/ s € õ Œw�~Š~˜dœiÑ(Ô(Ð(r c ó| — | ¦ « o(t j ¦ « | ¦ « k S )z¡ Test if the lock is held by the current process.
Returns ``True`` if the current process ID matches the
number stored in the PID file.
)r r Úgetpidr r s r Úi_am_lockingzPIDLockFile.i_am_locking7 s, € ð �~Š~ÑÔÐB¥B¤I¡K¤K°4·=²=±?´?Ò$BÐBr c óæ — |�|n| j }t j ¦ « }|�|dk r||z
} t | j ¦ « dS # t $ r¡}|j t
j k rkt j ¦ « |k r6|�|dk rt d| j z ¦ « ‚t d| j z ¦ « ‚t j |dur|dz pd¦ « nt d| j z ¦ « ‚Y d}~nd}~ww xY wŒÆ) z† Acquire the lock.
Creates the PID file for this lock, or raises an error if
the lock could not be acquired.
Nr Tz&Timeout waiting to acquire lock for %sz%s is already lockedé
gš™™™™™¹?zfailed to create %s)r ÚtimeÚwrite_pid_to_pidfiler ÚOSErrorÚerrnoÚEEXISTr
r Úsleepr )r r Úend_timeÚexcs r ÚacquirezPIDLockFile.acquire? s@ € ð %Ð0�'�'°d´lˆÝ”9‘;”;ˆØÐ 7¨Q¢; ;ؘшHð ð
Ý$ T¤YÑ/Ô/Ð/ð �øõ ð
Hð
Hð
HØ”9¥¤Ò,Ð,å”y‘{”{ XÒ-Ð-Ø"Ð.°7¸Q²;°;Ý"-ð /=à.2¬iñ/8ñ #9ô #9ð 9õ #0Ð0FØ04´ ñ1:ñ #;ô #;ð ;å”J˜w¨dÐ2ÐC°wÀ±|ÐJÀsÑKÔKÐKÐKå$Ð%:¸T¼YÑ%FÑGÔGÐGð LÐKÐKÐKÐKøøøøð
Høøøð s ®A Á
C/ÁBC*Ã*C/c óÚ — | ¦ « st d| j z ¦ « ‚| ¦ « st d| j z ¦ « ‚t | j ¦ « dS )z¥ Release the lock.
Removes the PID file to release the lock, or raises an
error if the current process does not hold the lock.
z%s is not lockedz%s is locked, but not by meN)r r r r r Úremove_existing_pidfiler s r ÚreleasezPIDLockFile.release_ sm € ð �~Š~ÑÔð <ÝÐ.°´Ñ:Ñ;Ô;Ð;Ø× Ò Ñ"Ô"ð GÝÐ9¸D¼IÑEÑFÔFÐFÝ ¤ Ñ*Ô*Ð*Ð*Ð*r c ó. — t | j ¦ « dS )z‚ Break an existing lock.
Removes the PID file if it already exists, otherwise does
nothing.
N)r- r r s r Ú
break_lockzPIDLockFile.break_lockl s € õ ¤ Ñ*Ô*Ð*Ð*Ð*r )FN)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r r r r+ r. r0 © r r r r s• € € € € € ðð ð%ð %ð %ð %ð0ð 0ð 0ð
)ð )ð )ðCð Cð Cðð ð ð ð@+ð +ð +ð+ð +ð +ð +ð +r r c ó — d} t | d¦ « }| ¦ « ¦ « } t |¦ « }n# t $ r Y nw xY w| ¦ « n# t $ r Y nw xY w|S )zï Read the PID recorded in the named PID file.
Read and return the numeric PID recorded as text in the named
PID file. If the PID file cannot be read, or if the content is
not a valid PID, return ``None``.
NÚr)ÚopenÚreadlineÚstripÚintÚ
ValueErrorÚcloseÚIOError)Úpidfile_pathÚpidÚpidfileÚlines r r r v s¦ € ð €CðÝ�| SÑ)Ô)ˆð ×ÒÑ!Ô!×'Ò'Ñ)Ô)ˆð Ý�d‘)”)ˆCˆCøÝð ð ð ØˆDð øøøà�
Š
‰Œˆˆøõ% ð
ð
ð
؈ð
øøøð( €Js" „A0 »A Á
AÁAÁ0
A=Á<A=c ó* — t j t j z t j z }d}t j | ||¦ « }t j |d¦ « }t j ¦ « }| d|z ¦ « | ¦ « dS )u° Write the PID in the named PID file.
Get the numeric process ID (“PID�) of the current process
and write it to the named file as a line of text.
i¤ Úwz%s
N) r ÚO_CREATÚO_EXCLÚO_WRONLYr8 Úfdopenr Úwriter= )r? Ú
open_flagsÚ open_modeÚ
pidfile_fdrA r@ s r r$ r$ ˜ sv € õ ”*�rœyÑ(2¬;Ñ6€JØ€IÝ”˜ z°9Ñ=Ô=€JÝŒi˜
CÑ(Ô(€Gõ
Œ)‰+Œ+€C؇M‚M�&˜3‘,ÑÔÐØ‡M‚M�O„O€O€O€Or c óŽ — t j | ¦ « dS # t $ r"}|j t j k rn‚ Y d}~dS d}~ww xY w)zÏ Remove the named PID file if it exists.
Removing a PID file that doesn't already exist puts us in the
desired state, so we ignore the condition if the file does not
exist.
N)r Úremover% r&