
    g+t              
       
   d Z ddlmZ ddlm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
ddlZddlZddlZddlmZ ddl	mZ ddl	mZ ddl	mZ 	 dd	l	mZ n# e$ r dZY nw xY w	 dd
l	mZ n# e$ r dZY nw xY wej        d         dk    ZerddlZndZ e ej        d                    Z e            Zg dZej        dk    Zej        dk    Z ej!        "                    d          Z#ej!        "                    d          Z$e$Z%ej!        "                    d          Z&ej!        "                    d          Z'ej!        "                    d          Z(e&pe'pe(Z)ej!        "                    d          Z*ej!        "                    d          Z+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4d Z5d!Z6d"Z7d#Z8d$Z9d%Z:d&Z;d'Z<d(Z=d)Z>d*Z?d+Z@d,ZAd-ZBd.ZCd/ZDd0ZEed1ZFd2ZGdZHn5 G d3 d4ejI                  ZJ eK            L                    eJjM                   ed5ZNd6ZOn5 G d7 d8ejI                  ZP eK            L                    ePjM                    ejQ                    ZResd9ZSn"	  ejT                    ZSn# eU$ r	 erd:nd9ZSY nw xY w ed;g d<          ZV ed=g d>          ZW ed?g d@          ZX edAg dB          ZY edCg dD          ZZ edEg dF          Z[ edGg dH          Z\ edIg dJ          Z] edKg dL          Z^ edMg dN          Z_ edOg dP          Z` edQg dR          Za edSg dT          Zb edUdVdWg          Zc edXg dY          Zd edZd[d\g          Ze ed]g d^          Zf ed_g d`          Zg edag d`          Zh edbg dc          Zi edddedfg          Zj edgdhdig          Zk edjg dk          Zl edldmdng          ZmeeegeegfeegegfegegfeegegfegegfeegeegfegeegfegeegfdoZne enL                    egegfegegfdp           eenL                    dqegeegfi            G dr dseo          Zp G dt duep          Zq G dv dweq          Zr G dx dyep          Zs G dz d{ep          Zter- euevew          r	evd|         Zxn eyevd|          Zx exd}           nd~ ZzddZ{d Z|d Z}d Z~d Ze|d             Zd Zd Zd ZddZd Z G d d          Zd Z e            Zej        e_        ej        e_        dZd Zd ZeefdZefdZddZd Zerd Znd Ze|ej        fd            ZddZddej        fdZd ZdS )z9Common objects shared by __init__.py and _ps*.py modules.    )division)print_functionN)
namedtuple)AF_INET)
SOCK_DGRAM)SOCK_STREAM)AF_INET6)AF_UNIX   PSUTIL_DEBUG)RFREEBSDBSDLINUXNETBSDOPENBSDMACOSOSXPOSIXSUNOSWINDOWS
CONN_CLOSECONN_CLOSE_WAITCONN_CLOSINGCONN_ESTABLISHEDCONN_FIN_WAIT1CONN_FIN_WAIT2CONN_LAST_ACKCONN_LISTEN	CONN_NONECONN_SYN_RECVCONN_SYN_SENTCONN_TIME_WAITNIC_DUPLEX_FULLNIC_DUPLEX_HALFNIC_DUPLEX_UNKNOWNSTATUS_DEADSTATUS_DISK_SLEEPSTATUS_IDLESTATUS_LOCKEDSTATUS_RUNNINGSTATUS_SLEEPINGSTATUS_STOPPEDSTATUS_SUSPENDEDSTATUS_TRACING_STOPSTATUS_WAITINGSTATUS_WAKE_KILLSTATUS_WAKINGSTATUS_ZOMBIESTATUS_PARKEDENCODINGENCODING_ERRSr	   pconn	pcputimespctxswpgidspiopionice	popenfilepthreadpuidssconn	scpustatssdiskio	sdiskpart
sdiskusagesnetiosnicaddr	snicstatssswapsuser	conn_tmapdeprecated_methodisfile_strictmemoizeparse_environ_blockpath_exists_strictusage_percentsupports_ipv6sockfam_to_enumsocktype_to_enumwrap_numbers	open_textopen_binarycatbcatbytes2humanconn_to_ntupledebughiliteterm_supports_colorsprint_colorposixntlinuxdarwin)freebsdmidnightbsdopenbsdnetbsd)sunossolarisaixrunningsleepingz
disk-sleepstoppedztracing-stopzombiedeadz	wake-killwakingidlelockedwaiting	suspendedparkedESTABLISHEDSYN_SENTSYN_RECV	FIN_WAIT1	FIN_WAIT2	TIME_WAITCLOSE
CLOSE_WAITLAST_ACKLISTENCLOSINGNONE      c                       e Zd ZdZdZdZdS )	NicDuplexr   r   r   N)__name__
__module____qualname__r#   r$   r%        J/var/www/html/ai-engine/env/lib/python3.11/site-packages/psutil/_common.pyr   r      s         r   r   c                       e Zd ZdZdZdS )BatteryTimer   r   N)r   r   r   POWER_TIME_UNKNOWNPOWER_TIME_UNLIMITEDr   r   r   r   r      s        !r   r   replacesurrogateescaperG   )totalusedfreepercentsinsoutrC   )r   r   r   r   rA   )
read_countwrite_count
read_byteswrite_bytes	read_time
write_timerB   )device
mountpointfstypeoptsrD   )
bytes_sent
bytes_recvpackets_sentpackets_recverrinerroutdropindropoutrH   )nameterminalhoststartedpidr?   )fdfamilytypeladdrraddrstatusr   rE   )r   addressnetmask	broadcastptprF   )isupduplexspeedmtuflagsr@   )ctx_switches
interruptssoft_interruptssyscallsscpufreq)currentminmaxshwtemp)labelr   highcriticalsbattery)r   secsleftpower_pluggedsfanr   r   r7   )usersystemchildren_userchildren_systemr<   pathr   r=   )id	user_timesystem_timer>   )real	effectivesavedr9   r:   )r   r   r   r   r;   ioclassvaluer8   	voluntaryinvoluntaryr6   )r   r   r   r   r   r   addripport)alltcptcp4udpudp4inetinet4inet6)tcp6udp6unixc                   (    e Zd ZdZdZd Zd Zd ZdS )ErrorzQBase exception class. All other psutil exceptions inherit
    from this one.
    psutilc                     t          j                    }|D ],}t          | |d           }|r|||<   |dk    r|dk    r|||<   -|S )Nr   r   )collectionsOrderedDictgetattr)selfattrsinfor   r   s        r   	_infodictzError._infodict$  sc    &(( 	# 	#DD$--E #"T

5A::"T
r   c                     |                      d          }|r5dd                    d |                                D                       z  }nd }d                    d t          | dd          |fD                       S )	N)r   ppidr   z(%s), c                 "    g | ]\  }}|d |S =r   .0kvs      r   
<listcomp>z!Error.__str__.<locals>.<listcomp>3  s'    ;;;daAAAqq!;;;r    c                     g | ]}||S r   r   )r   xs     r   r   z!Error.__str__.<locals>.<listcomp>7  s    MMMq1MMMMr   msg )r   joinitemsr   r   r   detailss      r   __str__zError.__str__.  s    ~~566 	tyy;;djjll;;;    GG GxxMMWT5"%=%=w$GMMMNNNr   c                     |                      d          }d                    d |                                D                       }d| j        j        d|dS )N)r   r   r   secondsr  r   c                 "    g | ]\  }}|d |S r   r   r   s      r   r   z"Error.__repr__.<locals>.<listcomp><  s'    GGG$!Q11-GGGr   zpsutil.())r   r  r  	__class__r   r  s      r   __repr__zError.__repr__9  sX    ~~GHH))GG$**,,GGGHH"&."9"9"9777CCr   N)r   r   r   __doc__r   r
  r  r   r   r   r   r     sZ          J  	O 	O 	OD D D D Dr   r   c                   $    e Zd ZdZdZddZd ZdS )NoSuchProcesszXException raised when a process with a certain PID doesn't
    or no longer exists.
    r   Nc                 h    t                               |            || _        || _        |pd| _        d S )Nzprocess no longer existsr   __init__r   r   r  r   r   r   r  s       r   r  zNoSuchProcess.__init__G  s3    t	44r   c                 8    | j         | j        | j        | j        ffS Nr  r   r   r  r   s    r   
__reduce__zNoSuchProcess.__reduce__M      49dh ?@@r   NNr   r   r   r  r  r  r   r   r   r  r  @  sM          J5 5 5 5A A A A Ar   r  c                   $    e Zd ZdZdZddZd ZdS )ZombieProcessa1  Exception raised when querying a zombie process. This is
    raised on macOS, BSD and Solaris only, and not always: depending
    on the query the OS may be able to succeed anyway.
    On Linux all zombie processes are querable (hence this is never
    raised). Windows doesn't have zombie processes.
    r   Nc                 `    t                               | |||           || _        |pd| _        d S )Nz"PID still exists but it's a zombie)r  r  r   r  )r   r   r   r   r  s        r   r  zZombieProcess.__init__[  s4    tS$444	>>r   c                 D    | j         | j        | j        | j        | j        ffS r  )r  r   r   r   r  r  s    r   r  zZombieProcess.__reduce__`  s     49di JKKr   NNNr   r   r   r   r"  r"  Q  sM          J? ? ? ?
L L L L Lr   r"  c                   $    e Zd ZdZdZddZd ZdS )AccessDeniedz@Exception raised when permission to perform an action is denied.r   Nc                 h    t                               |            || _        || _        |pd| _        d S )Nr  r  r  s       r   r  zAccessDenied.__init__i  s1    t	9"r   c                 8    | j         | j        | j        | j        ffS r  r  r  s    r   r  zAccessDenied.__reduce__o  r  r   r%  r   r   r   r   r'  r'  d  sG        JJJ   A A A A Ar   r'  c                   $    e Zd ZdZdZddZd ZdS )TimeoutExpiredzWRaised on Process.wait(timeout) if timeout expires and process
    is still alive.
    r   Nc                 x    t                               |            || _        || _        || _        d|z  | _        d S )Nztimeout after %s seconds)r   r  r  r   r   r  )r   r  r   r   s       r   r  zTimeoutExpired.__init__z  s9    t	-7r   c                 8    | j         | j        | j        | j        ffS r  )r  r  r   r   r  s    r   r  zTimeoutExpired.__reduce__  s    tx CDDr   r  r   r   r   r   r+  r+  s  sM          J8 8 8 8E E E E Er   r+  execzvdef raise_from(value, from_value):
    try:
        raise value from from_value
    finally:
        value = None
    c                     | r  r   )r   
from_values     r   
raise_fromr1    s    r   c                 x    	 t          |           |z  dz  }|t          ||          }|S # t          $ r Y dS w xY w)z5Calculate percentage usage of 'used' against 'total'.d   Ng        )floatroundZeroDivisionError)r   r   round_rets       r   rO   rO     s\    T{{U"c) V$$C
    sss   + 
99c                 f     t          j                    fd            }fd}i ||_        |S )a  A simple memoize decorator for functions supporting (hashable)
    positional arguments.
    It also provides a cache_clear() function for clearing the cache:

    >>> @memoize
    ... def foo()
    ...     return 1
        ...
    >>> foo()
    1
    >>> foo.cache_clear()
    >>>

    It supports:
     - functions
     - classes (acts as a @singleton)
     - staticmethods
     - classmethods

    It does NOT support:
     - methods
    c                      | t          t          |                                                    f}	 |         S # t          $ r6 	  | i |x}|<   n"# t          $ r}t          |d           d }~ww xY w|cY S w xY wr  )	frozensetsortedr  KeyError	Exceptionr1  )argskwargskeyr8  errcachefuns        r   wrapperzmemoize.<locals>.wrapper  s    Yvfllnn55667	: 	 	 	,#&3#7#7#77eCjj , , , d+++,JJJ	s3   ; 
A;AA;
A3A..A33A;:A;c                  0                                       dS )zClear cache.N)clear)rC  s   r   cache_clearzmemoize.<locals>.cache_clear  s    r   )	functoolswrapsrH  )rD  rE  rH  rC  s   `  @r   rL   rL     sf    0 _S	 	 	 	 	 	     E%GNr   c                 n     t          j                    fd            }d }d }||_        ||_        |S )a  A memoize decorator which is disabled by default. It can be
    activated and deactivated on request.
    For efficiency reasons it can be used only against class methods
    accepting no arguments.

    >>> class Foo:
    ...     @memoize
    ...     def foo()
    ...         print(1)
    ...
    >>> f = Foo()
    >>> # deactivated (default)
    >>> foo()
    1
    >>> foo()
    1
    >>>
    >>> # activated
    >>> foo.cache_activate(self)
    >>> foo()
    1
    >>> foo()
    >>> foo()
    >>>
    c                 N   	 | j                  }n# t          $ r1 	  |           cY S # t          $ r}t          |d           d }~ww xY wt          $ rN 	  |           }n"# t          $ r}t          |d           d }~ww xY w	 || j         <   n# t          $ r Y nw xY wY nw xY w|S r  )_cacheAttributeErrorr>  r1  r=  )r   r8  rB  rD  s      r   rE  z'memoize_when_activated.<locals>.wrapper  s   	+c"CC 	, 	, 	,,s4yy    , , , d+++, 	 	 	,c$ii , , , d+++,#&C  !    	 
sv    
B"
)B"
AAAB"A! B"!
B +A;;B  B"
BB"
BB"BB"!B"c                     i | _         dS )zsActivate cache. Expects a Process instance. Cache will be
        stored as a "_cache" instance attribute.
        N)rM  procs    r   cache_activatez.memoize_when_activated.<locals>.cache_activate  s     r   c                 .    	 | ` dS # t          $ r Y dS w xY w)zDeactivate and clear cache.N)rM  rN  rP  s    r   cache_deactivatez0memoize_when_activated.<locals>.cache_deactivate  s2    	 	 	 	DD	s    
)rI  rJ  rR  rT  )rD  rE  rR  rT  s   `   r   memoize_when_activatedrU    sh    6 _S    2     ,G/GNr   c                     	 t          j        |           }t          j        |j                  S # t          $ r+}|j        t
          j        t
          j        fv r Y d}~dS d}~ww xY w)zSame as os.path.isfile() but does not swallow EACCES / EPERM
    exceptions, see:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html.
    NF)osstatS_ISREGst_modeOSErrorerrnoEPERMEACCES)r   strB  s      r   rK   rK     so    
(WT]] |BJ'''    9el333uuuuus   / 
A$ AA$c                     	 t          j        |            dS # t          $ r+}|j        t          j        t          j        fv r Y d}~dS d}~ww xY w)zSame as os.path.exists() but does not swallow EACCES / EPERM
    exceptions. See:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html.
    TNF)rW  rX  r[  r\  r]  r^  )r   rB  s     r   rN   rN   -  sb    

 t    9el333uuuuus    
A AAc                  (   t           j        rt          dS 	 t          j         t          t           j                  } t	          j        |           5  |                     d           ddd           n# 1 swxY w Y   dS # t           j        $ r Y dS w xY w)z2Return True if IPv6 is supported on this platform.NF)z::1r   T)sockethas_ipv6r	   r   
contextlibclosingbinderror)socks    r   rP   rP   <  s     ? h.u}Xv'9::%% 	" 	"IIj!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"t<   uus5   8A> A1%A> 1A55A> 8A59A> >BBc                    i }d}t           }	 |                     d|          }||k    rnU|                     d||          }||k    r2| ||         }| |dz   |         }|r|                                }|||<   |dz   }r|S )zCParse a C environ block of environment variables into a dictionary.r   T r   r   )r   findupper)datar8  posWINDOWS_next_pos	equal_posrA  r   s           r   rM   rM   J  s     C
C H99T3''s??IIc311	s??s9}%CQ12E "iikkCHl  Jr   c                 b    t           | S 	 t          j        |           S # t          $ r | cY S w xY w)zConvert a numeric socket family value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    )enumrb  AddressFamily
ValueErrornums    r   rQ   rQ   f  sH     |
	',,, 	 	 	JJJ	    ..c                 b    t           | S 	 t          j        |           S # t          $ r | cY S w xY w)zConvert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    )rs  rb  
SocketKindru  rv  s    r   rR   rR   s  sH     |
	$S))) 	 	 	JJJ	rx  c           	      p   |t           j        t          fv r|r	t          | }|r	t          | }|t           j        k    r,|t          t          fv r|                    |t                    }nt          }t          |          }t          |          }|t          | |||||          S t          | ||||||          S )z2Convert a raw connection tuple to a proper ntuple.)rb  r   r	   r   r   getr   rQ   rR   r6   r?   )r   famtype_r   r   r   
status_mapr   s           r   rY   rY     s    
v~x((( 	!%LE 	!%LE"""sw.A'A'A	22
#

CU##E
{ReUE6:::ReUE63???r   c                       fd}|S )zA decorator which can be used to mark a method as deprecated
    'replcement' is the method name which will be called instead.
    c                     | j         dd| j        | _        t          j        |           fd            }|S )Nz*() is deprecated and will be removed; use z
() insteadc                 h    t          j        t          d            t          |           |i |S )Nr   )category
stacklevel)warningswarnDeprecationWarningr   )r   r?  r@  r  replacements      r   innerz/deprecated_method.<locals>.outer.<locals>.inner  s:    M#(:qIIII-74--t>v>>>r   )r   r  rI  rJ  )rD  r  r  r  s     @r   outerz deprecated_method.<locals>.outer  sf    LLLKK
 ;CK				? 	? 	? 	? 	? 
		? r   r   )r  r  s   ` r   rJ   rJ     s#    
     Lr   c                   8    e Zd ZdZd Zd Zd Zd Zd	dZd Z	dS )
_WrapNumberszNWatches numbers so that they don't overflow and wrap
    (reset to zero).
    c                 `    t          j                    | _        i | _        i | _        i | _        d S r  )	threadingLocklockrC  	remindersreminder_keysr  s    r   r  z_WrapNumbers.__init__  s-    N$$	
r   c                     || j         vsJ || j        vsJ || j        vsJ || j         |<   t          j        t
                    | j        |<   t          j        t                    | j        |<   d S r  )rC  r  r  r   defaultdictintset)r   
input_dictr   s      r   	_add_dictz_WrapNumbers._add_dict  s}    4:%%%%4>))))4-----%
4*6s;;t#.#:3#?#?4   r   c                    | j         |         }t          |                                          t          |                                          z
  }|D ]4}| j        |         |         D ]}| j        |         |= | j        |         |= 5dS )zIn case the number of keys changed between calls (e.g. a
        disk disappears) this removes the entry from self.reminders.
        N)rC  r  keysr  r  )r   r  r   old_dict	gone_keysgone_keyremkeys          r   _remove_dead_remindersz#_WrapNumbers._remove_dead_reminders  s     :d#((3z/@/@+A+AA	! 	3 	3H,T28< 1 1N4(00"4(22	3 	3r   c                 l   || j         vr|                     ||           |S |                     ||           | j         |         }i }|D ]}||         }	 ||         }n# t          $ r |||<   Y %w xY wg }t	          t          |                    D ]}	||	         }
||	         }||	f}|
|k     rA| j        |         |xx         |z  cc<   | j        |         |                             |           |	                    |
| j        |         |         z              t          |          ||<   || j         |<   |S )zlCache dict and sum numbers which overflow and wrap.
        Return an updated copy of `input_dict`.
        )rC  r  r  r=  rangelenr  r  addappendtuple)r   r  r   r  new_dictrA  input_tuple	old_tuplebitsiinput_value	old_valuer  s                r   runz_WrapNumbers.run  s    tz!!NN:t,,,##J555:d# 	( 	(C$S/K$SM		    !,	 D3{++,, H H)!n%aL	q**N4(000I=000&t,S155f===K$.*>v*FFGGGG!$KKHSMM%
4s   AA/.A/Nc                    | j         5  |L| j                                         | j                                         | j                                         nQ| j                            |d           | j                            |d           | j                            |d           ddd           dS # 1 swxY w Y   dS )z>Clear the internal cache, optionally only for function 'name'.N)r  rC  rG  r  r  pop)r   r   s     r   rH  z_WrapNumbers.cache_clear  s    Y 	3 	3|
  """$$&&&"((****
tT***""4..."&&tT222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3s   B B55B9<B9c                 l    | j         5  | j        | j        | j        fcddd           S # 1 swxY w Y   dS )z5Return internal cache dicts as a tuple of 3 elements.N)r  rC  r  r  r  s    r   
cache_infoz_WrapNumbers.cache_info  s    Y 	D 	DJ0BC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Ds   )--r  )
r   r   r   r  r  r  r  r  rH  r  r   r   r   r  r    s              @ @ @	3 	3 	3% % %N
3 
3 
3 
3D D D D Dr   r  c                     t           j        5  t                               | |          cddd           S # 1 swxY w Y   dS )zGiven an `input_dict` and a function `name`, adjust the numbers
    which "wrap" (restart from zero) across different calls by adding
    "old value" to "new value" and return an updated dict.
    N)_wnr  r  )r  r   s     r   rS   rS     s    
 
 ) )wwz4(() ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )s   599i   c                 0    t          | dt                    S )Nrb	buffering)openFILE_READ_BUFFER_SIZE)fnames    r   rU   rU     s    t'<====r   c                     t           st          | t                    S t          | t          t          t                    }	 t          |_        n.# t          $ r Y n"t          $ r |                                  w xY w|S )zOn Python 3 opens a file in text mode by using fs encoding and
    a proper en/decoding errors handler.
    On Python 2 this is just an alias for open(name, 'rt').
    r  )r  encodingerrors)	PY3r  r  r4   r5   _CHUNK_SIZErN  r>  close)r  fobjs     r   rT   rT   "  s    
  <E%:;;;;
 '	  D 1      

 Ks   A 
A9A9c                 ,   |t           u r9 ||           5 }|                                cddd           S # 1 swxY w Y   dS 	  ||           5 }|                                cddd           S # 1 swxY w Y   dS # t          t          f$ r |cY S w xY w)zRead entire file content and return it as a string. File is
    opened in text mode. If specified, `fallback` is the value
    returned in case of error, either if the file does not exist or
    it can't be read().
    N)_DEFAULTreadIOErrorr[  )r  fallback_openfs       r   rV   rV   @  s1    8U5\\ 	Q6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 		u  vvxx                                   ! 	 	 	OOO	sB   6::A= A0#A= 0A44A= 7A48A= =BBc                 0    t          | |t                    S )z,Same as above but opens file in binary mode.)r  r  )rV   rU   )r  r  s     r   rW   rW   Q  s    ux{;;;;r   %(value).1f%(symbol)sc                 P   d}i }t          |dd                   D ]\  }}d|dz   dz  z  ||<   t          |dd                   D ]F}t          |           ||         k    r+t          |           ||         z  }|t	                      z  c S G|t          |d         |           z  S )zUsed by various scripts. See: http://goo.gl/zeJZl.

    >>> bytes2human(10000)
    '9.8K'
    >>> bytes2human(100001221)
    '95.4M'
    )	BKMGTPEZYr   N
   r   )symbolr   )	enumeratereversedabsr4  localsdict)nformatsymbolsprefixr  sr  r   s           r   rX   rX   V  s     <GF'!""+&& & &1!a%2%q		7122;'' % %q66VF^##!HHvf~-EFHH$$$$ $ D
!44444r   c                  0    t           j        d         j        S )z+Return updated psutil.PROCFS_PATH constant.r   )sysmodulesPROCFS_PATHr   r   r   get_procfs_pathr  i  s    ;x ,,r   c                 D    |                      t          t                    S )N)r  r  )decoder4   r5   r  s    r   r  r  p  s    xx-x@@@r   c                     | S r  r   r  s    r   r  r  u  s    r   c                     t           j        dk    rdS 	 dd l}|                                 sJ |                                 |                    d          dk    sJ 	 dS # t          $ r Y dS w xY w)Nr_   Tr   colorsF)rW  r   cursesisatty	setuptermtigetnumr>  )filer  s     r   r\   r\   ~  s    	w$t	{{}}x((1,,,,, t    uus   A	A   
A.-A.Fc                    t                      s| S g }t          ddddddddd	
	  	        }d|d<   	 ||         }n?# t          $ r2 t          dt	          |                                          z            w xY w|                    |           |r|                    d           dd                    |          d| dS )z*Return an highlighted version of 'string'.343330323736913593)	bluebrowndarkgreygreengrey	lightblueredvioletyellow29Nz#invalid color %r; choose between %s1z[;mz[0m)r\   r  r=  ru  listr  r  r  )r  colorboldattrr  s        r   r[   r[     s    !! D
 
 
F F4L
u 
 
 
1T&++--5H5HI
 
 	

 	KK C"%((4....!!!44s	   : <A6c           
         t                      st          | |           dS t          r"t          t          | ||          |           dS ddl}d}|j        j        j        }|j        j        j        }t          dddd          }||d<   	 ||         }nB# t          $ r5 t          d	|d
t          |                                                    w xY w|r|dk    r|dz  }|t          j        u rdnd}	|j        |_         ||	          }
 ||
|           	 t          | |            ||
|           dS #  ||
|           w xY w)z$Print a colorized version of string.r  r   N   r         )r  r  r  r  zinvalid color z; choose between    ii)r\   printr   r[   ctypeswindllKernel32GetStdHandleSetConsoleTextAttributer  r=  ru  r  r  r  stderrc_ulongrestype)r  r	  r
  r  r  DEFAULT_COLORr  r  r  	handle_idhandles              r   r]   r]     s     !!  ;ad	 ;fQt$$4000000}-:M": 	  A1Aa888$t	5MEE 	 	 	*55$v{{}}---/  	
  	EQJJQJE3:--CC3	%~i((...	;!$##FM:::::##FM::::s   B ?CD9 9Ec                 P   t           rddl}|                    |                                j                  \  }}}}}t          | t                    r-t          | t          t          t          f          rd| z  } nd| z  } t          d|d|d| t          j                   dS dS )	z@If PSUTIL_DEBUG env var is set, print a debug message to stderr.r   Nzignoring %szignoring %rzpsutil-debug [:z]> r  )r   inspectgetframeinfocurrentframef_back
isinstancer>  r[  r  EnvironmentErrorr  r  r  )r  r   r  lineno__lines_indexs          r   rZ   rZ     s     
+2+?+?  ""),
 ,
(vq&& c9%% 	*#2BCDD *#c)#c)*/%%=CJ	
 	
 	
 	
 	
 	

 
r   r  )r  )NF)r  
__future__r   r   r   rd  r\  rI  rW  rb  rX  r  r  r  r   r   r   r   r	   ImportErrorr
   version_infor  rs  boolgetenvr   objectr  __all__r   r   r   platform
startswithr   r   r   r   r   r   r   r   AIXr*   r+   r'   r,   r.   r2   r&   r0   r1   r(   r)   r/   r-   r3   r   r!   r    r   r   r"   r   r   r   r   r   r   r#   r$   r%   IntEnumr   globalsupdate__members__r   r   r   getfilesystemencodingr4   r5   getfilesystemencodeerrorsrN  rG   rC   rA   rB   rD   rH   r?   rE   rF   r@   r   r   r   r   r7   r<   r=   r>   r9   r:   r;   r8   r6   r   rI   r>  r   r  r"  r'  r+  r$  __builtins__r  exec_r   r1  rO   rL   rU  rK   rN   rP   rM   rQ   rR   rY   rJ   r  rS   r  rH  r  r  rU   rT   rV   rW   rX   r  r  stdoutr\   r[   r]   rZ   r   r   r   <module>r=     s  
 @ ?
        % % % % % %              				   



      " " " " " "                     HHH   GGG
 
qQ KKKKD tIBIn--..688  L 	7
'T/(())
,
!
!"<
=
=
,
!
!)
,
,		 	 	*	*""F 455	le$$   $    ! 
	 <OO    DL   
 GIIY*+++ <" " " " "dl " " " GII[,--- %3$&&
 BMMB5577 B B B-2A))	B 	
7 % % % 	& 	& Z&J&J&JKK

*Y !< !< !< = = J{$N$N$NOO		H 4 4 4 
5 
5
 	
7JJJKK
7 . . . 	/ 	/ :jJJJL L J{BBBD D	 JNNNP P	 :j";";";<<
*7779 9 :j"J"J"JKKz&7I.// JGGG 	 J{VTN33	
*Y B B B
C
C
7:::;;
7:::;;j	EEE  *YG 4
5
5	H{M:	;	;
AAA	 	
 z&4.)) h(;
*CDh+/Y&h*.Y%x ;
";<i+z23j;
34	 		 k]+j\*    
 fy;
*CDEFFF D  D  D  D  DI  D  D  DFA A A A AE A A A"L L L L LM L L L&A A A A A5 A A AE E E E EU E E E2  z,%% .V$f--	E  	 	 	 	  	 	 	 	* * *ZD D DN( ( (   	
 
 	
  8
 
 

 
 
@ @ @ @&  .TD TD TD TD TD TD TD TDn) ) ) lnn? .  " > > >  < !	    " " < < < <
5 5 5 5&- - -
  A A A A
   	!j    	5 5 5 5< CJ$; $; $; $;N
 
 
 
 
s6   A A! A!%A, ,A65A6I! !I/.I/