HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //proc/self/root/usr/local/lib64/python3.9/site-packages/psutil/__pycache__/_common.cpython-39.pyc
a

q�dg+t�
@shdZddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddl	mZddl	mZddl	mZzdd	l	mZWney�dZYn0zdd
l	mZWney�dZYn0ejddkZe�r
ddlZndZee�d��Ze�Zgd
�ZejdkZejdkZ ej!�"d�Z#ej!�"d�Z$e$Z%ej!�"d�Z&ej!�"d�Z'ej!�"d�Z(e&�p�e'�p�e(Z)ej!�"d�Z*ej!�"d�Z+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4d Z5d!Z6d"Z7d#Z8d$Z9d%Z:d&Z;d'Z<d(Z=d)Z>d*Z?d+Z@d,ZAd-ZBd.ZCd/ZDd0ZEedu�r&d1ZFd2ZGdZHn Gd3d4�d4ejI�ZJeK��LeJjM�edu�rZd5ZNd6ZOn Gd7d8�d8ejI�ZPeK��LePjM�e�Q�ZRe�s�d9ZSn0ze�T�ZSWn"eU�y�e�r�d:nd9ZSYn0ed;gd<��ZVed=gd>��ZWed?gd@��ZXedAgdB��ZYedCgdD��ZZedEgdF��Z[edGgdH��Z\edIgdJ��Z]edKgdL��Z^edMgdN��Z_edOgdP��Z`edQgdR��ZaedSgdT��ZbedUdVdWg�ZcedXgdY��ZdedZd[d\g�Zeed]gd^��Zfed_gd`��Zgedagd`��Zhedbgdc��Ziedddedfg�Zjedgdhdig�Zkedjgdk��Zledldmdng�Zmeeegeegfeegegfegegfeegegfegegfeegeegfegeegfegeegfdo�Znedu�r�en�Legegfegegfdp��edu�r�en�Ldqegeegfi�Gdrds�dseo�ZpGdtdu�duep�ZqGdvdw�dweq�ZrGdxdy�dyep�ZsGdzd{�d{ep�Zte�rBeuevew��r.evd|Zxn
eyevd|�Zxexd}�nd~d�Zzd�d�d��Z{d�d��Z|d�d��Z}d�d��Z~d�d��Ze|d�d���Z�d�d��Z�d�d��Z�d�d��Z�d�d�d��Z�d�d��Z�Gd�d��d��Z�d�d��Z�e��Z�e�j�e�_�e�j�e�_�d�Z�d�d��Z�d�d��Z�ee�fd�d��Z�efd�d��Z�d�d�d��Z�d�d��Z�e�r&d�d��Z�nd�d��Z�e|ej�fd�d���Z�d�d�d��Z�dd�ej�fd�d��Z�d�d��Z�dS)�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)ZfreebsdZmidnightbsdZopenbsdZnetbsd)�sunos�solaris�aix�runningZsleepingz
disk-sleep�stoppedztracing-stopZzombieZdeadz	wake-killZwaking�idle�lockedZwaitingZ	suspendedZparkedZESTABLISHEDZSYN_SENTZSYN_RECVZ	FIN_WAIT1Z	FIN_WAIT2Z	TIME_WAITZCLOSEZ
CLOSE_WAITZLAST_ACKZLISTENZCLOSING�NONE��c@seZdZdZdZdZdS)�	NicDuplexrirjrN)�__name__�
__module__�__qualname__r"r#r$�roro�:/usr/local/lib64/python3.9/site-packages/psutil/_common.pyrk�srk������c@seZdZdZdZdS)�BatteryTimerqrrN)rlrmrn�POWER_TIME_UNKNOWN�POWER_TIME_UNLIMITEDrorororprs�srs�replace�surrogateescaperF)�total�used�free�percent�sinZsoutrB)rxryrzr{r@)�
read_count�write_count�
read_bytes�write_bytesZ	read_timeZ
write_timerA)ZdeviceZ
mountpointZfstype�optsrC)Z
bytes_sentZ
bytes_recvZpackets_sentZpackets_recvZerrinZerroutZdropinZdropoutrG)�nameZterminal�host�started�pidr>)�fd�family�type�laddr�raddr�statusr�rD)r��address�netmask�	broadcastZptprE)ZisupZduplex�speedZmtu�flagsr?)Zctx_switchesZ
interruptsZsoft_interruptsZsyscalls�scpufreq)�current�min�max�shwtemp)�labelr��high�critical�sbattery)r{ZsecsleftZ
power_plugged�sfanr�r�r6)�user�system�
children_user�children_systemr;�pathr�r<)�idZ	user_timeZsystem_timer=)�realZ	effectiveZsavedr8r9)r}r~rr�r:Zioclass�valuer7Z	voluntaryZinvoluntaryr5)r�r�r�r�r�r��addr�ip�port)�allZtcpZtcp4ZudpZudp4ZinetZinet4Zinet6)Ztcp6Zudp6�unixc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�ErrorzQBase exception class. All other psutil exceptions inherit
    from this one.
    �psutilcCsHt��}|D]6}t||d�}|r*|||<q|dkr|dkr|||<q|S)Nr�r)�collections�OrderedDict�getattr)�self�attrs�infor�r�rororp�	_infodict$s

zError._infodictcCsP|�d�}|r,dd�dd�|��D��}nd}d�dd�t|dd	�|fD��S)
N)r��ppidr�z(%s)�, cSsg|]\}}d||f�qS�z%s=%rro��.0�k�vrororp�
<listcomp>3�z!Error.__str__.<locals>.<listcomp>� cSsg|]}|r|�qSroro)r��xrororpr�7r��msg�)r��join�itemsr��r�r��detailsrororp�__str__.s
�z
Error.__str__cCs2|�d�}d�dd�|��D��}d|jj|fS)N)r�r�r��secondsr�r�cSsg|]\}}d||f�qSr�ror�rororpr�<r�z"Error.__repr__.<locals>.<listcomp>z
psutil.%s(%s))r�r�r��	__class__rlr�rororp�__repr__9s
zError.__repr__N)rlrmrn�__doc__r�r�r�rorororpr�s

r�c@s&eZdZdZdZddd�Zdd�ZdS)	�
NoSuchProcesszXException raised when a process with a certain PID doesn't
    or no longer exists.
    r�NcCs$t�|�||_||_|pd|_dS)Nzprocess no longer exists�r��__init__r�r�r��r�r�r�r�rororpr�Gs
zNoSuchProcess.__init__cCs|j|j|j|jffS�N�r�r�r�r��r�rororp�
__reduce__MszNoSuchProcess.__reduce__)NN�rlrmrnr�r�r�rorororpr�@s
r�c@s&eZdZdZdZddd�Zdd�ZdS)	�
ZombieProcessa1Exception 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�NcCs$t�||||�||_|pd|_dS)Nz"PID still exists but it's a zombie)r�r�r�r�)r�r�r�r�r�rororpr�[szZombieProcess.__init__cCs|j|j|j|j|jffSr�)r�r�r�r�r�r�rororpr�`szZombieProcess.__reduce__)NNNr�rorororpr�Qs
r�c@s&eZdZdZdZddd�Zdd�ZdS)	�AccessDeniedz@Exception raised when permission to perform an action is denied.r�NcCs$t�|�||_||_|pd|_dS)Nr�r�r�rororpr�is
zAccessDenied.__init__cCs|j|j|j|jffSr�r�r�rororpr�oszAccessDenied.__reduce__)NNNr�rorororpr�ds
r�c@s&eZdZdZdZddd�Zdd�ZdS)	�TimeoutExpiredzWRaised on Process.wait(timeout) if timeout expires and process
    is still alive.
    r�NcCs*t�|�||_||_||_d||_dS)Nztimeout after %s seconds)r�r�r�r�r�r�)r�r�r�r�rororpr�zs

zTimeoutExpired.__init__cCs|j|j|j|jffSr�)r�r�r�r�r�rororpr��szTimeoutExpired.__reduce__)NNr�rorororpr�ss
r��execzvdef raise_from(value, from_value):
    try:
        raise value from from_value
    finally:
        value = None
    cCs|�dSr�ro)r��
from_valuerororp�
raise_from�sr�cCsDzt|�|d}Wnty(YdS0|dur<t||�}|SdS)z5Calculate percentage usage of 'used' against 'total'.�dgN)�float�ZeroDivisionError�round)ryrxZround_�retrororprN�s
rNcs2t�����fdd��}�fdd�}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
s�|tt|����f}z
�|WSty~z�|i|��}�|<Wn.tyt}zt|d��WYd}~n
d}~00|YS0dSr�)�	frozenset�sortedr��KeyError�	Exceptionr�)�args�kwargs�keyr��err��cache�funrorp�wrapper�s
 zmemoize.<locals>.wrappercs���dS)zClear cache.N)�clearro)r�rorp�cache_clear�szmemoize.<locals>.cache_clear)�	functools�wrapsr�)r�r�r�ror�rprK�srKcs6t����fdd��}dd�}dd�}||_||_|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
s�z|j�}Wn�ty^z�|�WYStyX}zt|d��WYd}~n
d}~00Ynpty�z�|�}Wn.ty�}zt|d��WYd}~n
d}~00z||j�<Wnty�Yn0Yn0|Sr�)�_cache�AttributeErrorr�r�r�)r�r�r��r�rorpr��s"$ z'memoize_when_activated.<locals>.wrappercSs
i|_dS)zsActivate cache. Expects a Process instance. Cache will be
        stored as a "_cache" instance attribute.
        N)r���procrororp�cache_activatesz.memoize_when_activated.<locals>.cache_activatecSs z|`WntyYn0dS)zDeactivate and clear cache.N)r�r�r�rororp�cache_deactivatesz0memoize_when_activated.<locals>.cache_deactivate)r�r�r�r�)r�r�r�r�ror�rp�memoize_when_activated�sr�c
CsZzt�|�}Wn:tyH}z"|jtjtjfvr2�WYd}~dSd}~00t�|j�SdS)z�Same 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�OSError�errno�EPERM�EACCES�S_ISREG�st_mode)r��str�rororprJsrJc
CsRzt�|�Wn:tyH}z"|jtjtjfvr2�WYd}~dSd}~00dSdS)z�Same as os.path.exists() but does not swallow EACCES / EPERM
    exceptions. See:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html.
    NFT)r�r�r�r�r�r�)r�r�rororprM-srMcCsvtjrtdurdSzHt�ttj�}t�|��|�d�Wd�n1sL0YWdStjypYdS0dS)z2Return True if IPv6 is supported on this platform.NF)z::1rT)�socket�has_ipv6rr�
contextlib�closing�bind�error)�sockrororprO<s(rOcCsvi}d}t}|�d|�}||kr"qr|�d||�}||krh|||�}||d|�}|r`|��}|||<|d}q|S)zCParse a C environ block of environment variables into a dictionary.r��=rj)r�find�upper)�datar��posZWINDOWS_Znext_posZ	equal_posr�r�rororprLJs
rLcCs4tdur|Szt�|�WSty.|YS0dS)z�Convert a numeric socket family value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N)�enumr��
AddressFamily�
ValueError��numrororprPfsrPcCs4tdur|Szt�|�WSty.|YS0dS)zConvert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N)r	r��
SocketKindrrrororprQssrQcCs�|tjtfvr&|rt|�}|r&t|�}|tjkrJ|ttfvrJ|�|t�}nt}t|�}t|�}|durxt	||||||�St
|||||||�SdS)z2Convert a raw connection tuple to a proper ntuple.N)r�rrr�r�getrrPrQr5r>)r��fam�type_r�r�r�Z
status_mapr�rororprX�srXcs�fdd�}|S)z�A decorator which can be used to mark a method as deprecated
    'replcement' is the method name which will be called instead.
    cs:d|j�f�|jdur�|_t�|���fdd��}|S)Nz8%s() is deprecated and will be removed; use %s() insteadcs$tj�tdd�t|��|i|��S)Nri)�category�
stacklevel)�warnings�warn�DeprecationWarningr�)r�r�r�)r��replacementrorp�inner�sz/deprecated_method.<locals>.outer.<locals>.inner)rlr�r�r�)r�r�r)r�rp�outer�s�
z deprecated_method.<locals>.outerro)rrrorrprI�srIc@sBeZdZdZdd�Zdd�Zdd�Zdd	�Zddd�Zd
d�Z	d
S)�_WrapNumberszNWatches numbers so that they don't overflow and wrap
    (reset to zero).
    cCs t��|_i|_i|_i|_dSr�)�	threading�Lock�lockr��	reminders�
reminder_keysr�rororpr��s
z_WrapNumbers.__init__cCsX||jvsJ�||jvsJ�||jvs*J�||j|<t�t�|j|<t�t�|j|<dSr�)r�rr r��defaultdict�int�set)r��
input_dictr�rororp�	_add_dict�s
z_WrapNumbers._add_dictcCs\|j|}t|���t|���}|D]0}|j||D]}|j||=q8|j||=q&dS)z�In case the number of keys changed between calls (e.g. a
        disk disappears) this removes the entry from self.reminders.
        N)r�r#�keysr r)r�r$r��old_dictZ	gone_keysZgone_key�remkeyrororp�_remove_dead_reminders�s
z#_WrapNumbers._remove_dead_remindersc
	Cs||jvr|�||�|S|�||�|j|}i}|D]�}||}z||}Wntyn|||<Yq8Yn0g}tt|��D]f}	||	}
||	}||	f}|
|kr�|j|||7<|j||�|�|�	|
|j||�q�t
|�||<q8||j|<|S)zlCache dict and sum numbers which overflow and wrap.
        Return an updated copy of `input_dict`.
        )r�r%r)r��range�lenrr �add�append�tuple)
r�r$r�r'Znew_dictr�Zinput_tupleZ	old_tuple�bits�iZinput_value�	old_valuer(rororp�run�s2



z_WrapNumbers.runNcCs||j�b|dur0|j��|j��|j��n*|j�|d�|j�|d�|j�|d�Wd�n1sn0YdS)z>Clear the internal cache, optionally only for function 'name'.N)rr�r�rr �pop)r�r�rororpr��s

z_WrapNumbers.cache_clearcCs:|j� |j|j|jfWd�S1s,0YdS)z5Return internal cache dicts as a tuple of 3 elements.N)rr�rr r�rororp�
cache_info�sz_WrapNumbers.cache_info)N)
rlrmrnr�r�r%r)r2r�r4rorororpr�s'
rcCs6tj�t�||�Wd�S1s(0YdS)z�Given 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)�_wnrr2)r$r�rororprRsrRi�cCst|dtd�S)N�rb��	buffering)�open�FILE_READ_BUFFER_SIZE)�fnamerororprTsrTcCs\tst|td�St|tttd�}z
t|_Wn,ty<YntyV|���Yn0|S)z�On 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').
    r7)r8�encoding�errors)	�PY3r9r:r3r4�_CHUNK_SIZEr�r��close)r;�fobjrororprS"s �
rSc	Cs�|tur:||��}|��Wd�S1s.0YnRz6||��}|��Wd�WS1sd0YWnttfy�|YS0dS)z�Read 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�frororprU@s
(
,rUcCst||td�S)z,Same as above but opens file in binary mode.)rErF)rUrT)r;rErororprVQsrV�%(value).1f%(symbol)scCs�d}i}t|dd��D]\}}d|dd>||<qt|dd��D]2}t|�||krFt|�||}|t�SqF|t|d|d�S)z�Used by various scripts. See: http://goo.gl/zeJZl.

    >>> bytes2human(10000)
    '9.8K'
    >>> bytes2human(100001221)
    '95.4M'
    )	�B�K�M�G�T�P�E�Z�YrjN�
r)�symbolr�)�	enumerate�reversed�absr��locals�dict)�n�format�symbols�prefixr0�srSr�rororprWVsrWcCstjdjS)z+Return updated psutil.PROCFS_PATH constant.r�)�sys�modulesZPROCFS_PATHrorororp�get_procfs_pathisr`cCs|jttd�S)N)r<r=)�decoder3r4�r]rororprapsracCs|Sr�rorbrororprauscCs^tjdkrdSz2ddl}|��s$J�|��|�d�dks>J�WntyTYdS0dSdS)Nr^Tr�colorsF)r�r��curses�isattyZ	setuptermZtigetnumr�)�filerdrororpr[~s
r[FcCs�t�s
|Sg}tddddddddd	d
�	}d|d<z||}Wn&tybtd
t|�����Yn0|�|�|r||�d�dd�|�|fS)z*Return an highlighted version of 'string'.Z34Z33Z30Z32Z37Z36Z91Z35Z93)	Zblue�brownZdarkgrey�greenZgreyZ	lightblue�redZviolet�yellowZ29Nz#invalid color %r; choose between %s�1z[%sm%s�;)r[rXr�r�listr&r-r�)r]�color�bold�attrrcrororprZ�s2��


rZc	Cs
t�st||d�n�tr.tt|||�|d�n�ddl}d}|jjj}|jjj}t	ddddd�}||d<z||}Wn*t
y�td	|t|�
��f��Yn0|r�|dkr�|d
7}|tjur�dnd}	|j|_||	�}
||
|�zt||d�W||
|�n||
|�0dS)
z$Print a colorized version of string.�rfrN�ri��)rhrirgrjz#invalid color %r; choose between %r�i�i����)r[�printrrZ�ctypes�windll�Kernel32�GetStdHandle�SetConsoleTextAttributerXr�rrmr&r^�stderr�c_ulong�restype)r]rnrorfrwZ
DEFAULT_COLORrzr{rcZ	handle_id�handlerororpr\�s8
���

r\cCsntrjddl}|�|��j�\}}}}}t|t�rRt|ttt	f�rJd|}nd|}t
d|||ftjd�dS)z@If PSUTIL_DEBUG env var is set, print a debug message to stderr.rNzignoring %szignoring %rzpsutil-debug [%s:%s]> %srq)
r�inspect�getframeinfo�currentframe�f_back�
isinstancer�r�rD�EnvironmentErrorrvr^r|)r�r�r;�lineno�_�_lines�_indexrororprY�s�

�rY)N)N)rH)NF)�r��
__future__rrr�r�r�r�r�r�r�r^rrrrrrr�ImportErrorr	�version_infor>r	�bool�getenvr�objectrB�__all__r�rr�platform�
startswithrrrrrrr
rZAIXr)r*r&r+r-r1r%r/r0r'r(r.r,r2rr rrrr!rrrrrrr"r#r$�IntEnumrk�globals�update�__members__rtrurs�getfilesystemencodingr3r4�getfilesystemencodeerrorsr�rFrBr@rArCrGr>rDrEr?r�r�r�r�r6r;r<r=r8r9r:r7r5r�rHr�r�r�r�r�r�r��__builtins__rX�exec_r�r�rNrKr�rJrMrOrLrPrQrXrIrrRr5r�r4r:rTrSrUrVrWr`ra�stdoutr[rZr\rYrorororp�<module>sp


&

	

�������	

�


�
#



-G



W	

	
�
'