
     h"                        d dl mZ d dlZd dlZd dlZd dlZddlmZmZ ej	        dk    r	 d dl
Z
n# e$ r	 d dlmZ
 Y nw xY wdZ
	 d dlZn# e$ r dZY nw xY w	 d dlmZ eeefZn# e$ r eefZY nw xY wej        dk    red	cZZned
cZZ eed          rej        Zerd Znd Znd Z	 ej        Zej        Zn# e$ r d Z e            \  ZZ[Y nw xY wej        d          dk    re Z ne Z! G d de!          Z d Z"d+dZ#d Z$	 ej%        Z%d+dZ&n# e$ r
 d Z%d+dZ&Y nw xY wd Z'	 d dl(Z(d Z)n# e$ r d Z)Y nw xY wej	        dk    rd Z*d Z+nd dlm,Z, d dl-m-Z-m.Z.m/Z/ d  Z+d! Z*d"Z0d#Z1ej	        dk    r	 d dl2Z2n# e$ r dZ2Y nw xY wd$ Z3dS 	 d d%lm4Z4m5Z5 n# e$ r dxZ4Z5Y nw xY wd&ej	        v sej	        d'k    rd( Z6nd) Z6d* Z3dS ),    )absolute_importN   )rangezip_longestwin32)r   )UnsupportedOperation)         TFwritec                 2    t          | ||d                    S N)	__write__fdbufoffsets      K/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/billiard/compat.pysend_offsetr   )   s    RVWW...    c                 >    t          | t          ||                    S r   )r   buf_tr   s      r   r   r   .   s    RsF!3!3444r   c                      t          d          )Nr   NotImplementedErrorr   s      r   r   r   3   s    !-000r   c                  b    t          j                    dk    rdndfd} fd}| |fS )Nmbcsstrictsurrogateescapec                     t          | t                    r| S t          | t                    r|                               S t	          dt          |           j        z            )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errorss    r   fsencodez_fscodec.<locals>.fsencodeB   sh     (E** ;Hc** ;x888 ="&x.."9!: ; ; ;r   c                     t          | t                    r| S t          | t                    r|                               S t	          dt          |           j        z            )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!   )r"   r$   r#   decoder&   r'   r(   r)   s    r   fsdecodez_fscodec.<locals>.fsdecodeQ   sh     (C(( ;He,, ;x888 ="&x.."9!: ; ; ;r   )sysgetfilesystemencoding)r-   r0   r+   r,   s     @@r   _fscodecr3   ;   sr    ,..vFF&F	; 	; 	; 	; 	; 	;	; 	; 	; 	; 	; 	; !!r      c                       e Zd Zd ZdS )r#   c                     t          |          dk    r% t          |d                   j        |dd           S t          | S )Nr   r   )len_bytesr%   )clsargss     r   __new__zbytes.__new__o   s=    4yy1}}-vd1g-tABBx884= r   N)r(   
__module____qualname__r;    r   r   r#   r#   m   s#        	! 	! 	! 	! 	!r   r#   c                     t          | t          j                  r| S 	 |                                 S # t          $ r Y dS w xY w)z3Get object fileno, or :const:`None` if not defined.N)r"   numbersIntegralfilenoFILENO_ERRORS)fs    r   maybe_filenorE   u   sQ    !W%&& xxzz   s   2 
A A c                     	 t          j        d          S #  Y nxY wt          | S t          j        t          j                  d         }|t          j        k    r| S |S )zReturn the maximum number of open file descriptors
    on this system.

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

    SC_OPEN_MAXNr   )ossysconfresource	getrlimitRLIMIT_NOFILERLIM_INFINITY)defaultfdmaxs     r   	get_fdmaxrP      s`    z-(((x566q9E&&&Ls    c                 <    t                      fd| D             S )z7Return all unique elements in ``it``, preserving order.c              3   N   K   | ]}|v                     |          p|V   d S r   )add).0objseens     r   	<genexpr>zuniq.<locals>.<genexpr>   s6      BBS#T//DHHSMM S////BBr   )set)itrV   s    @r   uniqrZ      s&    55DBBBBBBBBBr   c                 
   d | pg D             } t          t          t          d                              D ]I}|| vrC	 t          j        |           # t
          $ r }|j        t          j        k    r Y d }~Ad }~ww xY wJd S )Nc                 J    g | ] }t          |          t          |          !S r   )rE   rT   rD   s     r   
<listcomp>z"close_open_fds.<locals>.<listcomp>   s6     F F Fa)D Q)D)D)Dr      rN   )reversedr   rP   rH   closeOSErrorerrnoEBADF)keepr   excs      r   close_open_fdsrh      s    F F*"F F F54!8!8!899:: 	 	B~~HRLLLL   yEK// 0//// 	 	s    A
A?A::A?c                     t          t          | |                    D ]D}	 t          j        |           # t          $ r }|j        t
          j        k    r Y d }~=d }~ww xY wd S r   )ra   r   rH   rb   rc   rd   re   )fd_lowfd_highr   rg   s       r   
closerangerl      s    51122 	 	B   9++ ,++++	 	s   6
A  AA c                 f   t          t          t          d t          t          | pg           D                                           } t          d          }t          dg| z             t          | |gz             }}t          ||          D ]!\  }}|dz   |k    rt          |dz   |           "d S )Nc              3      K   | ]}||V  	d S r   r>   r]   s     r   rW   z!close_open_fds.<locals>.<genexpr>   s+        
  
A 
  
r   r_   r`   r   )	listrZ   sortedmaprE   rP   iterr   rl   )rf   maxfdkLkHlowhighs         r   rh   rh      s    D  
  
<44 
  
  
 
 
     $'''rdTk""D$8$8B$R,, 	* 	*ICQw$37D)))	* 	*r   c                     	 | j         S # t          $ rV 	 t          | j        t                    r't          | j                  dk    r| j        d         cY S n# t          $ r Y nw xY wY nw xY wdS )zV:exc:`socket.error` and :exc:`IOError` first got
    the ``.errno`` attribute in Py2.7r	   r   )rd   AttributeErrorr"   r:   tupler7   )rg   s    r   	get_errnor|      s    y   	#(E** #s38}}/A/Ax{""" 	 	 	D	 1s8   	 
A)>AA)A)
A# A)"A##A)(A)c                    t          |          }t          j                    \  }}	 |t          |           gdt	          |          d d dddddd||ddg}t
          j        dk    r|                    d           |                    d            t          j
        | t          j        |           t          j        |           S # t          j        |           t          j        |           w xY w)NTro   F)r4   	   )NNNro   )rq   rH   piper-   r{   r1   version_infoextendappend_posixsubprocess	fork_execrb   )pathr:   passfdserrpipe_readerrpipe_writes        r   spawnv_passfdsr      s    //&(gii#m	$x~~&eGnndDBBBmuD 6))2333KK#-t4H\"""H]#### H\"""H]####s   A4C *C.c                 L   t           j        dk    r5|t          t           j                  t          t           j                  gz   }t          j                    }|sIt          t          d |D                                  t          j	        t          |           |           |S )Nr   c              3      K   | ]}||V  	d S r   r>   r]   s     r   rW   z!spawnv_passfds.<locals>.<genexpr>   s'      &?&?QQ&?q&?&?&?&?&?&?r   )rf   )r1   platformrE   stdoutstderrrH   forkrh   rq   execvr-   )r   r:   r   pids       r   r   r      s    <7"" SZ((SZ((! G gii 	+&?&?'&?&?&? ? ?@@@@HXd^^T***
r   c                      t          d          )Nz$setblocking not implemented on win32r   )handleblockings     r   setblockingr      s    !"HIIIr   c                      t          d          )Nz#isblocking not implemented on win32r   r   s    r   
isblockingr      s    !"GHHHr   )
O_NONBLOCK)fcntlF_GETFLF_SETFLc                 >    t          | t                    t          z   S r   )r   r   r   r   s    r   r   r      s    &'**Z788r   c                     t          | t          d          }t          | t          |r|t           z  n	|t          z             d S )Nr   )r   r   r   r   )r   r   flagss      r   r   r      sM    fgq))G%-EEj[!!5:3E	
 	
 	
 	
 	
r   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.
c                      t           &t          t                                                    t	          t          j        t          j                                                              d         dz            S )Nr         @)	psutilImportErrorE_PSUTIL_MISSINGstripintProcessrH   getpidmemory_infor>   r   r   mem_rssr     sV    >.44667776>")++..::<<Q?&HIIIr   )	getrusageRUSAGE_SELFbsddarwinc                 &    t          |           dz  S )Nr   r   vs    r   maxrss_to_kbr   )  s    q66F?"r   c                      t          |           S r   r   r   s    r   r   r   0  s    q66Mr   c                      t           Ct          t                                                              t
          j                            t          t          t                    j
                  S r   )rJ   r   E_RESOURCE_MISSINGr   formatr1   r   r   r   r   	ru_maxrssr>   r   r   r   r   4  sL    06688??MMNNNIk22<===r   r   )7
__future__r   rd   r@   rH   r1   fiver   r   r   _winapir   _multiprocessingr   rJ   ior   rz   
ValueErrorrC   r   
memoryviewr   is_new_bufferbufferhasattrr   r   r   r-   r0   r3   r#   r8   rE   rP   rZ   rl   rh   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r>   r   r   <module>r      s   & & & & & &   				 



 $ $ $ $ $ $ $ $<76 6 6 6555555556 GOOOO   HHH1''''''#Z1EFMM 1 1 1#Z0MMM1
 i%tE==!5E=
72w 1I 5	/ 	/ 	/ 	/
	5 	5 	5 	5
1 1 1,{H{HH ) ) )%" %" %"N "HhS)X A!EEF! ! ! ! ! ! ! !     (C C C J,	 	 	 	 	+  * * *  	* 	* 	* 	* 	* 	**B  $ $ $ $ $        @ <7J J JI I I I ----------9 9 9
 
 
   <7   J J J J J'333333333 ' ' '"&&	KKK'  8 8	# 	# 	# 	#	 	 	> > > > >s   0 >>A	 	AAA# #	A/.A/)B8 8CCD DD%D- -D87D83E8 8FFF 	F F 