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__/worker.cpython-39.pyc
a

�+�b�?�@sDddlmZddlZddlZddlZddlZddlZddlZzddlZej	Wne
ylddlmZYn0ddl
mZddlmZmZmZmZmZdd�Zd	d
�Zejr�dd�ZGd
d�de�Zndd�Zdd�Zejs�ejr�dZejZndZdZd!dd�Zd"dd�Z dd�Z!dd�Z"dd�Z#ej�r0e#Z$ne!Z$e"Z%dd �Z&dS)#�)�absolute_importN�)�
selectors2)�_)�encoding�error�pycompat�scmutil�utilc	Cstz tt�d��}|dkr|WSWnttfy6Yn0z ttjd�}|dkrV|WSWnttfynYn0dS)z-try to count the number of CPUs on the system�SC_NPROCESSORS_ONLNrsNUMBER_OF_PROCESSORSr)�int�os�sysconf�AttributeError�
ValueErrorr�environ�KeyError)�n�r�6/usr/lib64/python3.9/site-packages/mercurial/worker.py�	countcpus"s

rcCs^|�dd�}|rLzt|�}|dkr(|WSWn tyJt�td���Yn0ttt�d�d�S)N�workersnumcpusrs!number of cpus must be an integer�� )	ZconfigrrrZAbortr�min�maxr)�ui�srrrr�_numworkers8s
rcCst��t��kS�N)�	threading�current_thread�main_threadrrrr�ismainthreadFsr#c@sPeZdZdd�Zdejdd�kr.dkr:nndd�Zd	d
�Zddd
�ZdS)�_blockingreadercCs
||_dSr)�_wrapped)�self�wrappedrrr�__init__Jsz_blockingreader.__init__)��rNr))r)r*�cCs<d}t|�}||kr8|j�||d��}|s.q8||7}q|S�Nr)�lenr%�readinto)r&�b�pos�size�retrrrr.Ts
z_blockingreader.readintocCs
|j��Sr)r%�readline�r&rrrr3`sz_blockingreader.readline���cCsf|dkr|j��St|�}t|�}d}||krR|j�||d��}|sHqR||7}q&~||d�=t|�Sr,)r%�readall�	bytearray�
memoryviewr.�bytes)r&r1�buf�viewr0r2rrr�readds


z_blockingreader.read)r5)	�__name__�
__module__�__qualname__r(�sys�version_infor.r3r<rrrrr$Is
"r$cCstt��tj�Sr)�
isinstancer r!�_MainThreadrrrrr#yscCs|Srr)r'rrrr$~sg{�G�z�?gꌠ9Y>)FFTcCs8|strdS||}t|�}|t|||}|dkS)zetry to determine whether the benefit of multiple processes can
    outweigh the cost of starting themFg333333�?)�_DISALLOW_THREAD_UNSAFEr�
_STARTUP_COST)rZ	costperopZnops�
threadsafeZlinear�workersZbenefitrrr�
worthwhile�srHcCsX|�dd�}|r"ttur"t�s"d}|rJt||t|�|d�rJt|||||�S|||f�S)a0run a function, possibly in parallel in multiple worker
    processes.

    returns a progress iterator

    costperarg - cost of a single task

    func - function to run. It is expected to return a progress iterator.

    staticargs - arguments to pass to every invocation of the function

    args - arguments to split into chunks, to pass to individual
    workers

    hasretval - when True, func and the current function return an progress
    iterator then a dict (encoded as an iterator that yield many (False, ..)
    then a (True, dict)). The dicts are joined in some arbitrary order, so
    overlapping keys are a bad idea.

    threadsafe - whether work items are thread safe and can be executed using
    a thread-based worker. Should be disabled for CPU heavy tasks that don't
    release the GIL.
    rsenabledF)rF)Z
configbool�_platformworker�_posixworkerr#rHr-)rZ
costperarg�func�
staticargs�args�	hasretvalrFZenabledrrr�worker�srOc#s�t|�}t�tj��t�tjtj�t�dg����fdd��d��fdd�	����fdd�}t�tj|��|��t�	�}g�i}t
|t|t|���D�]b�t�
�\������f�d	}	z�zTt��}
|
dk�rt�tj��t�tj�������
�fd
d�}t�||�}	Wn@t�	�|k�r,�t��d}t|t�}
|j|
d�Yn0Wt�	�|k�r�z,z|��WnYn0Wt�|	d
@�nt�|	d
@�0nNt�	�|k�r�z,z|��WnYn0Wt�|	d
@�nt�|	d
@�00��|
�q�t���	�D],\��t����	�t��dd�tj��q����	�fdd�}z�t��}|dk�r,�	��D]�\}}z<t j!�"t#|j$��}|�r�|d�r�|�%|d�n|VWntt&�y��	�'|j$�|j$��|d8}YnDt(�y"}z*|j)t)j*k�rWYd}~�qj�WYd}~n
d}~00�qj�qXWn��|��Yn0|�}|�r||dk�rrt�+t�	�|�t,�-|��|�r�d|fVdS)Nrcsbt�tj���D]J}zt�|tj�WqtyZ}z|jtjkrF�WYd}~qd}~00qdSr)�signal�SIGCHLDr
�kill�SIGTERM�OSError�errnoZESRCH)�p�err)�oldchldhandler�pidsrr�killworkers�sz!_posixworker.<locals>.killworkersTcs����D]�}d}}z"t�||r$dntj�\}}Wq�Wqty�}zL|jtjkr`WYd}~qn&|jtjkr���|�WYd}~q�n�WYd}~qd}~00q|s�q��|�t	|�}|r�ds|�d<qdSr,)
�copyr
�waitpid�WNOHANGrTrU�EINTRZECHILD�discard�_exitstatus)�blocking�pidrV�st�e)rY�problemrr�waitforworkers�s$

z$_posixworker.<locals>.waitforworkerscs�dd��dr��dS)NF)rarr)Zsignum�frame)rZrerfrr�sigchldhandler�s
z$_posixworker.<locals>.sigchldhandlerr5cs`�dd�D]\}}t�|�t�|�qt������f�D]}t��tj�|��qBdS)Nr5r)r
�close�writer
�pickle�dumps)�r�w�result)rK�pargs�pipes�rfdrL�wfdrr�
workerfuncs

z _posixworker.<locals>.workerfunc)�force��rbcs2t�tj����t�tj������dSr,)rP�SIGINTrQrir)rX�
oldhandlerre�selectorrfrr�cleanup*s
z_posixworker.<locals>.cleanupr)T).rrP�	getsignalrx�SIG_IGN�setrQ�flushr
�getpid�	partitionrr-�pipe�append�forkr	Z	callcatchr@�exc_info�
issubclass�KeyboardInterrupt�	traceback�_exit�add�	selectorsZDefaultSelectorri�register�fdopenZ
EVENT_READZselectr
rk�loadr$Zfileobj�update�EOFErrorZ
unregister�IOErrorrUr^rRrZWorkerError)rrKrLrMrNrGrhZ	parentpid�retvalr2rbrt�exctyperur{Z	openpipes�keyZevents�resrd�statusr)
rKrZrXryrprYrqrerrrzrLrfrsrrJ�s�

	"�"



$

rJcCs.t�|�rt�|�St�|�r*t�|�SdS)z�convert a posix exit status into the same form returned by
    os.spawnv

    returns None if the process was stopped instead of exitingN)r
�	WIFEXITED�WEXITSTATUS�WIFSIGNALED�WTERMSIG)�coderrr�_posixexitstatusPs


r�c	#s�Gdd�dtj�}g���fdd�}t��}tj��}tj��}	i}
t||d�D]}|	�|�qRt|�D]$}||	|||�}
��	|
�|
�
�qjz�t��dk�r|��s�|�
�}|r�|dr�|
�|d�q�|Vq��d�d�d	d
��D�}|D] }
|
jdu�r
|
j���|
�q�q�Wn ttf�y:|��Yn0|���sx|�
�}|�rn|d�rn|
�|d�n|V�q<|�r�d|
fVdS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z_windowsworker.<locals>.Workerc_sHtjj|g|�Ri|��||_||_||_||_d|_d|_d|_	dS)NFT)
r �Threadr(�
_taskqueue�_resultqueue�_func�_staticargs�_interrupted�daemon�	exception)r&�	taskqueue�resultqueuerKrLrM�kwargsrrrr(]sz'_windowsworker.<locals>.Worker.__init__cSs
d|_dS)NT)r�r4rrr�	interruptisz(_windowsworker.<locals>.Worker.interruptc
Ss�zn|j��slzB|j��}|j|j|f�D] }|j�|�|jr*WWdSq*Wqtj	j
yhYqlYq0qWn,ty�}z||_�WYd}~n
d}~00dSr)
r��emptyZ
get_nowaitr�r�r��putr�r�queueZEmpty�	Exceptionr�)r&rMr�rdrrr�runls

z"_windowsworker.<locals>.Worker.runN)r=r>r?r(r�r�rrrr�Worker\sr�cs^t��d}�D]}|��q�D]6}|t��}|�|�|��r"��td��dSq"dS)Nrs:failed to kill worker threads while handling an exception
)�timer��join�is_alive�warnr)Z
cleanupend�tZ
remainingtime��threadsrrr�trykillworkers�s

��z&_windowsworker.<locals>.trykillworkers�rrg�������?cSsg|]}|��s|�qSr)r�)�.0Z_trrr�
<listcomp>��z"_windowsworker.<locals>.<listcomp>T)r r�rrr�ZQueuer�r��ranger��startr-r��getr�r�r��remover�r�)rrKrLrMrNr�r�rGr�r�r�rpZ_ir�r�Zfinishedthreadsrr�r�_windowsworker[sH$





r�ccs"t|�D]}||d|�VqdS)a�partition a list into N slices of roughly equal size

    The current strategy takes every Nth element from the input. If
    we ever write workers that need to preserve grouping in input
    we should consider allowing callers to specify a partition strategy.

    olivia is not a fan of this partitioning strategy when files are involved.
    In his words:

        Single-threaded Mercurial makes a point of creating and visiting
        files in a fixed order (alphabetical). When creating files in order,
        a typical filesystem is likely to allocate them on nearby regions on
        disk. Thus, when revisiting in the same order, locality is maximized
        and various forms of OS and disk-level caching and read-ahead get a
        chance to work.

        This effect can be quite significant on spinning disks. I discovered it
        circa Mercurial v0.4 when revlogs were named by hashes of filenames.
        Tarring a repo and copying it to another disk effectively randomized
        the revlog ordering on disk by sorting the revlogs by hash and suddenly
        performance of my kernel checkout benchmark dropped by ~10x because the
        "working set" of sectors visited no longer fit in the drive's cache and
        the workload switched from streaming to random I/O.

        What we should really be doing is have workers read filenames from a
        ordered queue. This preserves locality and also keeps any worker from
        getting more than one file out of balance.
    N)r�)ZlstZnslices�irrrr��sr�)T)FT)'Z
__future__rrUr
rPr@r r�r�ZBaseSelector�ImportErrorZ
thirdpartyrZi18nr�rrrr	r
rrZispy3r#�objectr$ZisposixZ	iswindowsrErDrHrOrJr�r�rIr`r�rrrr�<module>sJ
	0
�
%c

Youez - 2016 - github.com/yon3zu
LinuXploit