
    ɧd:              
       p   d Z ddlZddlZddlZddlZddlZddlZddlZg dZej	        d         dk    Z
 e            Ze
reZeZeZeZeZd Zd ZneZeZeZeZd Zd Ze
reZn	eZeed	fd
Ze
reZeZeZeZeZeZnddlZefdZ  e e!          d             Z e e!          d             Z e e!          d             Z e e!          d             Z e e!          d             Z e e!          d             Z ej"                    dk    r,	  e#ej$        d          # e$ r Y ne#$ r  e%d          w xY w	 ddlm&Z& nr# e'$ rj 	 ddl(m)Z) n# e'$ r	 ddl*m)Z) Y nw xY w ej+        dg d          Z, G d de-          Z. e            f e/eee0 e1d          f          e2e3e1e4fdZ5d)dZ&Y nw xY w	 ddl6m7Z7 n# e'$ r ej8        ej9        z  dfd Z7Y nw xY w	 dd!l6m:Z: n# e'$ r d*d#Z:Y nw xY w	 dd$l;m<Z= n# e'$ r  G d% d&          Z=Y nw xY w	 dd'lm>Z> dS # e'$ r ej?        d(             Z>Y dS w xY w)+zModule which provides compatibility with older Python versions.
This is more future-compatible rather than the opposite (prefer latest
Python 3 way of doing things).
    N)PY3longrangesuperunicode
basestringub	lru_cachewhichget_terminal_sizeredirect_stderrFileNotFoundErrorPermissionErrorProcessLookupErrorInterruptedErrorChildProcessErrorFileExistsError   c                     | S N ss    .lib/python3.11/site-packages/psutil/_compat.pyr	   r	   /           c                 ,    |                      d          S )Nzlatin-1)encoder   s    r   r
   r
   2   s    xx	"""r   c                 "    t          | d          S )Nunicode_escape)r   r   s    r   r	   r	   :   s    q*+++r   c                     | S r   r   r   s    r   r
   r
   =   r   r      c                 `   | t           u r}t          j        |          }	 |j        |j        j        d                  }n$# t          t          f$ r t          d          w xY w	 |j	        }nB# t          t          f$ r. 	 |j        j	        }n# t          $ r t          d          w xY wY nw xY w|D ]} | j                                        D ]}	 t          |t          j                  sft          |t"                    r|j        }n/	 |j        }n&# t          $ r |                    ||           }Y nw xY wt          |t          j                  fn# t          t*          f$ r Y w xY w|j        |j        u r n nt          d          |t           urt/          | |          S t/          |           S )zuLike Python 3 builtin super(). If called without any arguments
        it attempts to infer them at runtime.
        r   z'super() used in a function with no argsz$super() used in a non-newstyle classzsuper() called outside a method)	_SENTINELsys	_getframef_localsf_codeco_varnames
IndexErrorKeyErrorRuntimeError__mro__AttributeError	__class____dict__values
isinstancetypesFunctionTypepropertyfget__func____get__	TypeError	func_code_builtin_super)type_type_or_obj
framedepthfmromeths         r   r   r   L   s=    I )	Fj))ANj)=a)@A) N N N"#LMMMNO!)"L1 O O OO%/7CC% O O O&'MNNNO CO
  F F!N1133  D!",T53E"F"F 
L)$99 	L (,y!L+/=DD'5 !L !L !L+/<<U+K+KDDD!L #-T53E"F"F 
L +I6 ! ! ! !~1  "#DEEE i' 	6!%555e$$$si   > !A#A+ +B*=B
	B*
B$$B*)B*7EDE D0-E/D00EE"!E"c                       fd}|S )Nc                 ^      G  fdd           j         _          j        _        S )Nc                   B     e Zd Z fdZ G fdde          Z xZS )E_instance_checking_exception.<locals>.wrapped.<locals>.TemporaryClassc           	      0   t          |          dk    rft          |d                   rP|d         }t          |          D ]6}|                    d          st	          | |t          ||                     7d S  t          |           j        |i | d S )Nr#   r   __)lenr3   dir
startswithsetattrgetattrr   __init__)selfargskwargs	unwrap_meattrTemporaryClassr0   s        r   rN   zN_instance_checking_exception.<locals>.wrapped.<locals>.TemporaryClass.__init__   s    4yyA~ N*T!Wn*M*M N$(G	$'	NN N ND#'??4#8#8 N 'dGIt4L4L M M MN N =nd33<dMfMMMMMr   c                        e Zd Z fdZd ZdS )S_instance_checking_exception.<locals>.wrapped.<locals>.TemporaryClass.__metaclass__c                      |          S r   r   )clsinstinstance_checkers     r   __instancecheck__ze_instance_checking_exception.<locals>.wrapped.<locals>.TemporaryClass.__metaclass__.__instancecheck__   s    //555r   c                 T    t          j                    d         }t          ||           S Nr#   )r&   exc_infor3   )rX   	classinfovalues      r   __subclasscheck__ze_instance_checking_exception.<locals>.wrapped.<locals>.TemporaryClass.__metaclass__.__subclasscheck__   s"     #q 1)%555r   N)__name__
__module____qualname__r[   ra   )rZ   s   r   __metaclass__rV      s=        6 6 6 6 66 6 6 6 6r   re   )rb   rc   rd   rN   typere   __classcell__)r0   rT   rZ   s   @r   rT   rF      sx        N N N N N N6 6 6 6 6 6 6D 6 6 6 6 6 6 6r   rT   )rb   __doc__)rZ   rT   base_exceptions   `@r   wrappedz-_instance_checking_exception.<locals>.wrapped   s\    6 6 6 6 6 6 6 6 6 6 6& '7&?N#%5%=N"!!r   r   )ri   rj   s   ` r   _instance_checking_exceptionrk      s#    	" 	" 	" 	" 	"0 r   c                 J    t          | dt                    t          j        k    S Nerrno)rM   r%   rn   ENOENTrY   s    r   r   r          tWi00EL@@r   c                 J    t          | dt                    t          j        k    S rm   )rM   r%   rn   ESRCHrp   s    r   r   r          tWi00EK??r   c                 ^    t          | dt                    t          j        t          j        fv S rm   )rM   r%   rn   EACCESEPERMrp   s    r   r   r      s)    tWi00L%+5' ' 	'r   c                 J    t          | dt                    t          j        k    S rm   )rM   r%   rn   EINTRrp   s    r   r   r      rt   r   c                 J    t          | dt                    t          j        k    S rm   )rM   r%   rn   ECHILDrp   s    r   r   r      rq   r   c                 J    t          | dt                    t          j        k    S rm   )rM   r%   rn   EEXISTrp   s    r   r   r      rq   r   CPythonpermzbbroken or incompatible Python implementation, see: https://github.com/giampaolo/psutil/issues/1659)r   )RLock	CacheInfo)hitsmissesmaxsizecurrsizec                   "    e Zd ZdZefdZd ZdS )
_HashedSeq	hashvaluec                 4    || d d <    ||          | _         d S r   r   )rO   tuphashs      r   rN   z_HashedSeq.__init__   s"    DG!T#YYDNNNr   c                     | j         S r   r   )rO   s    r   __hash__z_HashedSeq.__hash__   s
    >!r   N)rb   rc   rd   	__slots__r   rN   r   r   r   r   r   r      s?        	%) 	' 	' 	' 	'	" 	" 	" 	" 	"r   r   c	                 H   | }	|r, ||                                           }
|	|z  }	|
D ]}|	|z  }	|r7|	 |fd| D                       z  }	|r|	 |fd|
D                       z  }	n* ||	          dk    r |	d                   |v r|	d         S t          |	          S )Nc              3   .   K   | ]} |          V  d S r   r   ).0vrf   s     r   	<genexpr>z_make_key.<locals>.<genexpr>   s+      //Qa//////r   c              3   4   K   | ]\  }} |          V  d S r   r   )r   kr   rf   s      r   r   z_make_key.<locals>.<genexpr>   s/      >>ATT!WW>>>>>>r   r#   r   )itemsr   )rP   kwdstypedkwd_mark	fasttypessortedtuplerf   rI   keysorted_itemsitems          `    r   	_make_keyr      s      	!6$**,,//L8OC$  t 	55////$//////C ?uu>>>>>>>>>>SXX] 	ttCF||y8 	q6M#r   d   Fc                       fd}|S )z~Least-recently-used cache decorator, see:
        http://docs.python.org/3/library/functools.html#functools.lru_cache
        c                    	
 t                      ddgd\  t          j        t          
t	                      g d d gd d <   gd\  	dk    r fd}n$ f	d}n	
 fd}fd}fd} |_        ||_        ||_        t          j	        |           S )	Nr   )r   r#   )r   r#      r   c                  8     | i |}xx         dz  cc<   |S r]   r   )rP   r   resultMISSESstatsuser_functions      r   wrapperz7lru_cache.<locals>.decorating_function.<locals>.wrapper  s2    *]D9D99F&MMMQ&MMM!Mr   c                     	  | |          } |	          }|	ur
xx         dz  cc<   |S  | i |}||<   
xx         dz  cc<   |S r]   r   )rP   r   r   r   HITSr   cache	cache_getmake_keyrootr   r   r   s       r   r   z7lru_cache.<locals>.decorating_function.<locals>.wrapper  s    "(4u55C&YsD11FT) &dq(%*]D9D99F!'E#J&MMMQ&MMM!Mr   c                     |sr | |          }n| }                                  	  |          }|W\  }|\  }}}}||<   ||<   |         }|x|<   |<   ||<   ||<   xx         dz  cc<   |                                 S 	                                  n#                                  w xY w | i |}                                  	 \  }|v rn`           k    r4|}	||	<   ||	<   |	         x}d<   |         }
d x|<   |<   |
= |	|<   n|         }||||g}|x|<   x|<   |<   xx         dz  cc<                                    n#                                  w xY w|S )Nr#   r   )acquirerelease)rP   r   r   linkr   	link_prev	link_nextr   lastoldrootoldkeyr   KEYr   NEXTPREVRESULT_lenr   r   lockr   r   nonlocal_rootr   r   r   s              r   r   z7lru_cache.<locals>.decorating_function.<locals>.wrapper  s    #u #&htT599"LLNNN'(y~~ 
*$1ED@D=Iy#v.7IdO.7IdO#':D6::DJd)-DJ)-DJ!$KKK1,KKK#)
* *]D9D99FLLNNN' -%< H !T%[[G3 H&*G+.GCL.4GFO6=dmCD=#3%)#YF7;;DIV %f)0E#JJ#':D$($V#<DCGGDJGdeCjf*!Ms   AB% %B;A9E) )E?c                                                        	 t                             t                                                               S #                                  w xY w)zReport cache statistics)r   
_CacheInforI   r   )r   r   r   r   r   r   s   r   
cache_infoz:lru_cache.<locals>.decorating_function.<locals>.cache_infoJ  s\    #%eDk5='&)%jj2 2 LLNNNNDLLNNNNs   *A A,c                                                        	                                  d         } | | ddg| dd<   ddgdd<                                    dS #                                  w xY w)z$Clear the cache and cache statisticsr   N)r   clearr   )r   r   r   r   r   s    r   cache_clearz;lru_cache.<locals>.decorating_function.<locals>.cache_clearS  sv    #KKMMM(+D#T46DG !1vE!!!HLLNNNNNDLLNNNNs   0A A3)
dictr   getrI   r   __wrapped__r   r   	functoolsupdate_wrapper)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s   `   @@@@@@@@@@@@@@r   decorating_functionz&lru_cache.<locals>.decorating_function   s   FFEFELD& H	ID77DDT4.DG!FM&0#D$V!| <"" " " " " " " "  7"	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"+" +" +" +" +" +" +" +" +" +" +" +" +" +" +" +" +" +" +" +"Z# # # # # # # # # #	# 	# 	# 	# 	# 	# 	# 	# #0G!+G"-G+G]CCCr   r   )r   r   r   s   `` r   r   r      s7    a	D a	D a	D a	D a	D a	DF #"r   )r   c                 f    d }t           j                                       r | |          r S dS |*t           j                            dt           j                  }|sdS |                    t           j                  }t          j	        dk    rt           j
        |vr |                    dt           j
                   t           j                            dd                              t           j                  }t           fd|D                       r g}n fd	|D             }n g}t                      }|D ]q}t           j                            |          }||vrL|                    |           |D ]4}	t           j                            ||	          }
 ||
|          r|
c c S 5rdS )
aJ  Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such
        file.

        `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
        of os.environ.get("PATH"), or can be overridden with a custom search
        path.
        c                     t           j                            |           o4t          j        | |          ot           j                            |            S r   )ospathexistsaccessisdir)fnmodes     r   _access_checkzwhich.<locals>._access_checks  sD    GNN2&& *29R+>+> *b)))+r   NPATHwin32r   PATHEXT c              3      K   | ]=}                                                     |                                           V  >d S r   )lowerendswithr   extcmds     r   r   zwhich.<locals>.<genexpr>  sA      HH399;;''		44HHHHHHr   c                     g | ]}|z   S r   r   r   s     r   
<listcomp>zwhich.<locals>.<listcomp>  s    666ss666r   )r   r   dirnameenvironr   defpathsplitpathsepr&   platformcurdirinsertanysetnormcaseaddjoin)r   r   r   r   pathextfilesseenrJ   normdirthefilenames   `          r   r   r   j  s   	+ 	+ 	+ 7??3 	}S$'' 
4 	6:>>&"*55D 	4zz"*%%<7" 
	y$ *Ary)))jnnY3399"*EEGHHHHHHHHH 76666g666EEuu 	$ 	$Cg&&s++Gd" $!!!$ $ $G7<<W55D$}T400 $#$tr   )r   P      c                     	 dd l }dd l}dd l}	 |                    d|                    d|j        d                    }|d         |d         fS # t          $ r | cY S w xY w# t          $ r | cY S w xY w)Nr   hhr#   1234)fcntlstructtermiosunpackioctl
TIOCGWINSZ	ExceptionImportError)fallbackr   r   r   ress        r   r   r     s    	 LLLMMMNNN mm%++a);VDDF FAA''         	 	 	OOO	s"   A! ?A AA!A0/A0)TimeoutExpiredc                       e Zd ZdS )SubprocessTimeoutExpiredN)rb   rc   rd   r   r   r   r	  r	    s        r   r	  )r   c              #      K   t          t          d          }	 t          t          d|            | V  t          t          d|           d S # t          t          d|           w xY w)Nstderr)rM   r&   rL   )
new_targetoriginals     r   r   r     sh      3))	-C:...C8,,,,,GC8,,,,s   A A#)r   F)r   )@rh   collections
contextlibrn   r   r   r&   r4   __all__version_infor   objectr%   intr   r   xrangestrr   r   r	   r
   r   r<   r   r   r   r   r   r   r   r  rk   EnvironmentErrorpython_implementationOSErrorr}   r-   r   r  	threadingr   dummy_threading
namedtupler   listr   r   	frozensetrf   r   r   rI   r   shutilr   F_OKX_OKr   
subprocessr  r	  r   contextmanagerr   r   r   <module>r#     s  
 
              				 



 @ @ @$ 
qQFHH	 DFGJE  # # # # DEGJ, , ,    7%EEN9 2% 2% 2% 2%p  HC)%O+')%OO OOO4=    6 "!"233A A 43A "!"233@ @ 43@ "!"233' ' 43' "!"233@ @ 43@ "!"233A A 43A "!"233A A 43A &x%''94 C	C'%,/// 	 	 	D 	C 	C 	C,BC C C	CN######## L# L# L#*####### * * *))))))))* ('>>>@ @J" " " " "T " " " #FHH<Cc9dd4jj ABBu4S   $g# g# g# g# g# g#KL#`0 . . ."') - - - - - -.d (((((((                  &EEEEEEE            
-******** - - -- - - - - --s   D" "D9)D9=E F3
EF3EF3EAF32F37F> >GGG$ $	G0/G04G; ;HHH H54H5