HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/billiard/__pycache__/compat.cpython-310.pyc
o

!we��@s�ddlZddlZddlZddlZddlZddlmZejdkr5zddlZWne	y4ddl
mZYnwdZzddlZWne	yHdZYnwddl
mZeeefZeed�raejZdd�Znd	d�ZzejZejZWney�d
d�Ze�\ZZ[Ynwdd
�Zd/dd�Zdd�ZzejZWney�dd�Zd/dd�ZYnwd/dd�Zdd�ZzddlZWn
e	y�dd�Z Ynwdd�Z ejdkr�dd�Z!dd�Z"ndd lm#Z#dd!l$m$Z$m%Z%m&Z&d"d�Z"d#d�Z!d$Z'd%Z(ejdk�rzddl)Z)Wne	�y	dZ)Ynwd&d'�Z*dSz
dd(lm+Z+m,Z,Wne	�y(dZ+Z,Ynwd)ejv�s5ejd*k�r:d+d,�Z-nd-d,�Z-d.d'�Z*dS)0�N)�zip_longest�win32)r)�UnsupportedOperation�writecCst|||d��S�N)�	__write__��fd�buf�offset�r�H/home/arjun/projects/env/lib/python3.10/site-packages/billiard/compat.py�send_offsetsrcC�td��)Nr��NotImplementedErrorrrrr
r"�cs>t����dkrd�nd���fdd�}��fdd�}||fS)N�mbcs�strict�surrogateescapec�6t|t�r|St|t�r|����Stdt|�j��)a
            Encode filename to the filesystem encoding with 'surrogateescape'
            error handler, return bytes unchanged. On Windows, use 'strict'
            error handler if the file system encoding is 'mbcs' (which is the
            default encoding).
            �expect bytes or str, not %s)�
isinstance�bytes�str�encode�	TypeError�type�__name__��filename��encoding�errorsrr
�fsencode1�

�z_fscodec.<locals>.fsencodecr)a
            Decode filename from the filesystem encoding with 'surrogateescape'
            error handler, return str unchanged. On Windows, use 'strict' error
            handler if the file system encoding is 'mbcs' (which is the default
            encoding).
            r)rrr�decoderrrrr!rr
�fsdecode@r%z_fscodec.<locals>.fsdecode)�sys�getfilesystemencoding)r$r'rr!r
�_fscodec*sr*cCs0t|tj�r|Sz|��WStyYdSw)z3Get object fileno, or :const:`None` if not defined.N)r�numbers�Integral�fileno�
FILENO_ERRORS)�frrr
�maybe_filenoUs
�r0cCsDzt�d�WSYtdur|St�tj�d}|tjkr |S|S)z�Return the maximum number of open file descriptors
    on this system.

    :keyword default: Value returned if there's no file
                      descriptor limit.

    �SC_OPEN_MAXN�)�os�sysconf�resource�	getrlimit�
RLIMIT_NOFILE�
RLIM_INFINITY)�default�fdmaxrrr
�	get_fdmax_s
r;cst���fdd�|D�S)z7Return all unique elements in ``it``, preserving order.c3s&�|]}|�vr��|�p|VqdSr)�add)�.0�obj��seenrr
�	<genexpr>vs�$zuniq.<locals>.<genexpr>)�set)�itrr?r
�uniqssrDcCsXtt||��D]"}zt�|�Wqty)}z
|jtjkr�WYd}~qd}~wwdSr)�reversed�ranger3�close�OSError�errno�EBADF)�fd_low�fd_highr	�excrrr
�
closerange}s����rNcCs~tttdd�tt|pg�D����}tdd�}tdg|�t||g�}}t||�D]\}}|d|kr<t|d|�q+dS)Ncss�|]	}|dur|VqdSrr�r=r/rrr
rA�s��z!close_open_fds.<locals>.<genexpr>��r9���r2)	�listrD�sorted�mapr0r;�iterrrN)�keep�maxfd�kL�kH�low�highrrr
�close_open_fds�s�
��r]cCsxdd�|pgD�}tttdd���D]'}||vr9zt�|�Wqty8}z
|jtjkr.�WYd}~qd}~wwqdS)NcSs g|]}t|�durt|��qSr)r0rOrrr
�
<listcomp>�s�z"close_open_fds.<locals>.<listcomp>rPrQ)rErFr;r3rGrHrIrJ)rWr	rMrrr
r]�s������cCsz|jWStyYdSw)zV:exc:`socket.error` and :exc:`IOError` first got
    the ``.errno`` attribute in Py2.7r)rI�AttributeError)rMrrr
�	get_errno�s
�r`cCsZtjdkr|ttj�ttj�g}t��}|s+ttdd�|D��d�t�	t
|�|�|S)Nrcss�|]}|r|VqdSrrrOrrr
rA�s�z!spawnv_passfds.<locals>.<genexpr>)rW)r(�platformr0�stdout�stderrr3�forkr]rT�execvr$)�path�args�passfds�pidrrr
�spawnv_passfds�s
�rjcCs�t|�}t��\}}zK|t|�gdt|�dddddddd||ddg}tjdkr,|�d�tjdkr6|�d�|�d�tjdkrF|�t	j
�tj|�Wt�
|�t�
|�St�
|�t�
|�w)NTrRF)��)rk�	)NNNrR)rTr3�piper$�tupler(�version_info�append�extend�
subprocess�
_USE_VFORK�_posixsubprocess�	fork_execrG)rfrgrh�errpipe_read�
errpipe_writerrr
rj�s&�








�cCr)Nz$setblocking not implemented on win32r)�handle�blockingrrr
�setblocking�rr{cCr)Nz#isblocking not implemented on win32r�ryrrr
�
isblocking�rr})�
O_NONBLOCK)�fcntl�F_GETFL�F_SETFLcCst|t�t@Sr)rr�r~r|rrr
r}�scCs4t|td�}t|t|r|t@�dS|tB�dS)Nr)rr�r�r~)ryrz�flagsrrr
r{�s��z�
On Windows, the ability to inspect memory usage requires the psutil library.

You can install it using pip:

    $ pip install psutil
z�
Your platform ({0}) does not seem to have the `resource.getrusage' function.

Please open an issue so that we can add support for this platform.
cCs2tdur
tt����tt�t�����dd�S)Nr��@)	�psutil�ImportError�E_PSUTIL_MISSING�strip�int�Processr3�getpid�memory_inforrrr
�mem_rss�sr�)�	getrusage�RUSAGE_SELF�bsd�darwincCst|�dS)Nr��r���vrrr
�maxrss_to_kbsr�cCst|�Srr�r�rrr
r�scCs*tdurtt���tj���ttt	�j
�Sr)r5r��E_RESOURCE_MISSINGr��formatr(rar�r�r��	ru_maxrssrrrr
r�sr).rIr+r3rsr(�	itertoolsrra�_winapir��_multiprocessingrr5�iorr_�
ValueErrorr.�hasattrrrrr$r'r*r0r;rDrNr]r`rurjr{r}r~rr�r�r�r�r�r�r�r�r�rrrr
�<module>s�
��




'�,


�
	�

	��