HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/psutil/__pycache__/_common.cpython-310.pyc
o

�h�o�
@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
Z
ddlmZddlmZddlm
Z
zddlmZWneyQdZYnwzddlmZWneyedZYnwee�d	��Ze�Zgd
�ZejdkZejdkZej�d
�Zej�d�ZeZej�d�Zej�d�Z ej�d�Z!ep�e p�e!Z"ej�d�Z#ej�d�Z$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0d Z1d!Z2d"Z3d#Z4d$Z5d%Z6d&Z7d'Z8d(Z9d)Z:d*Z;d+Z<d,Z=d-Z>Gd.d/�d/ej?�Z@eA��Be@jC�Gd0d1�d1ej?�ZDeA��BeDjC�e�E�ZFe�G�ZHe
d2gd3��ZIe
d4gd5��ZJe
d6gd7��ZKe
d8gd9��ZLe
d:gd;��ZMe
d<gd=��ZNe
d>gd?��ZOe
d@gdA��ZPe
dBgdC��ZQe
dDgdE��ZRe
dFgdG��ZSe
dHgdI��ZTe
dJgdK��ZUe
dLdMdNg�ZVe
dOgdP��ZWe
dQdRdSg�ZXe
dTgdU��ZYe
dVgdW��ZZe
dXgdW��Z[e
dYgdZ��Z\e
d[d\d]g�Z]e
d^d_d`g�Z^e
dagdb��Z_e
dcdddeg�Z`eeege
egfeege
gfege
gfeegegfegegfeege
egfege
egfege
egfdf�Zaedu�r�ea�Bege
gfegegfdg��edu�re#�sea�Bdhege
egfi�Gdidj�djeb�ZcGdkdl�dlec�ZdGdmdn�dned�ZeGdodp�dpec�ZfGdqdr�drec�Zgd�dsdt�Zhdudv�Zidwdx�Zjdydz�Zkd{d|�Zleid}d~��Zmdd��Znd�d��Zod�d��Zpd�d�d��Zqd�d��Zrd�d��ZsGd�d��d��Ztd�d��Zuet�Zvevjweu_wevjxeu_xd�Zyd�d��Zzd�d��Z{ee{fd�d��Z|efd�d��Z}d�d�d��Z~d�d��Zd�d��Z�eiej�fd�d���Z�d�d�d��Z�dd�ej�fd�d��Z�d�d��Z�dS)�z�Common objects shared by __init__.py and _ps*.py modules.

Note: this module is imported by setup.py, so it should not import
psutil or third-party modules.
�N)�
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�NONEc@seZdZdZdZdZdS)�	NicDuplex��rN)�__name__�
__module__�__qualname__rr r!�r�r��A/usr/local/CyberCP/lib/python3.10/site-packages/psutil/_common.pyr|�sr|c@seZdZdZdZdS)�BatteryTime������N)rr�r��POWER_TIME_UNKNOWN�POWER_TIME_UNLIMITEDr�r�r�r�r��sr�rC)�total�used�free�percent�sin�soutr?)r�r�r�r�r=)�
read_count�write_count�
read_bytes�write_bytes�	read_time�
write_timer>)�device�
mountpoint�fstype�optsr@)�
bytes_sent�
bytes_recv�packets_sent�packets_recv�errin�errout�dropin�dropoutrD)�name�terminal�host�started�pidr;)�fd�family�type�laddr�raddr�statusr�rA)r��address�netmask�	broadcast�ptprB)�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�r3)�user�system�
children_user�children_systemr8�pathr�r9)�id�	user_time�system_timer:)�real�	effective�savedr5r6)r�r�r�r�r7�ioclass�valuer4�	voluntary�involuntaryr2)r�r�r�r�r�r��addr�ip�port)�all�tcp�tcp4�udp�udp4�inet�inet4�inet6)�tcp6�udp6�unixc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�ErrorzQBase exception class. All other psutil exceptions inherit
    from this one.
    �psutilcCs>t��}|D]}t||d�}|s|dkr|dkr|||<q|S)Nr�r)�collections�OrderedDict�getattr)�self�attrs�infor�r�r�r�r��	_infodicts�zError._infodictcCsR|�d�}|rd�d�dd�|��D���}nd}d�dd�t|dd	�|fD��S)
N)r��ppidr�z({})�, cS�g|]\}}|�d|���qS��=r���.0�k�vr�r�r��
<listcomp>�z!Error.__str__.<locals>.<listcomp>� cSsg|]}|r|�qSr�r�)r��xr�r�r�r�s�msg�)r��format�join�itemsr��r�r��detailsr�r�r��__str__s
� z
Error.__str__cCs8|�d�}d�dd�|��D��}d|jj�d|�d�S)N)r�r�r��secondsr�r�cSr�r�r�r�r�r�r�r�"r�z"Error.__repr__.<locals>.<listcomp>zpsutil.�(�))r�r�r��	__class__rr�r�r�r��__repr__s
zError.__repr__N)rr�r��__doc__r�r�rr�r�r�r�r�sr�c@�&eZdZdZdZddd�Zdd�ZdS)	�
NoSuchProcesszXException raised when a process with a certain PID doesn't
    or no longer exists.
    r�NcC�$t�|�||_||_|pd|_dS)Nzprocess no longer exists�r��__init__r�r�r��r�r�r�r�r�r�r�r
-�
zNoSuchProcess.__init__cC�|j|j|j|jffS�N�rr�r�r��r�r�r�r��
__reduce__3�zNoSuchProcess.__reduce__�NN�rr�r�rr
rr�r�r�r�r&s

rc@r)	�
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)rr
r�r�)r�r�r�r�r�r�r�r�r
AszZombieProcess.__init__cCs|j|j|j|j|jffSr)rr�r�r�r�rr�r�r�rFszZombieProcess.__reduce__�NNNrr�r�r�r�r7s

rc@r)	�AccessDeniedz@Exception raised when permission to perform an action is denied.r�NcCr)Nr�r	rr�r�r�r
OrzAccessDenied.__init__cCr
rrrr�r�r�rUrzAccessDenied.__reduce__rrr�r�r�r�rJs

rc@r)	�TimeoutExpiredzWRaised on Process.wait(timeout) if timeout expires and process
    is still alive.
    r�NcCs.t�|�||_||_||_d|�d�|_dS)Nztimeout after z seconds)r�r
rr�r�r�)r�rr�r�r�r�r�r
`s

zTimeoutExpired.__init__cCr
r)rrr�r�rr�r�r�rgrzTimeoutExpired.__reduce__rrr�r�r�r�rYs

rcCs@z
t|�|d}Wn
tyYdSw|durt||�}|S)z5Calculate percentage usage of 'used' against 'total'.�dgN)�float�ZeroDivisionError�round)r�r��round_�retr�r�r�rKps�
rKcs2t�����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
sn|tt|����f}z�|WSty6z�|i|��}�|<W|YSty5}z|d�d}~wwwr)�	frozenset�sortedr��KeyError�	Exception)�args�kwargs�keyr�err��cache�funr�r��wrapper�s
����zmemoize.<locals>.wrappercs���dS)zClear cache.N)�clearr�)r(r�r��cache_clear��zmemoize.<locals>.cache_clear)�	functools�wrapsr,)r)r*r,r�r'r�rH|srHcs6t����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�}W|Sty&z�|�WYSty%}z|d�d}~wwtyWz�|�}WntyA}z|d�d}~wwz	||j�<WY|StyVYY|Swwr)�_cache�AttributeErrorr"r!)r�rr&�r)r�r�r*�s2��������z'memoize_when_activated.<locals>.wrappercSs
i|_dS)zsActivate cache. Expects a Process instance. Cache will be
        stored as a "_cache" instance attribute.
        N)r0��procr�r�r��cache_activate�s
z.memoize_when_activated.<locals>.cache_activatecSs z|`WdStyYdSw)zDeactivate and clear cache.N)r0r1r3r�r�r��cache_deactivate�s

�z0memoize_when_activated.<locals>.cache_deactivate)r.r/r5r6)r)r*r5r6r�r2r��memoize_when_activated�sr7cCs>zt�|�}Wnty�tyYdSwt�|j�S)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.
    F)�os�stat�PermissionError�OSError�S_ISREG�st_mode)r��str�r�r�rG�s�rGcCs4zt�|�WdSty�tyYdSw)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.
    FT)r8r9r:r;)r�r�r�r�rJ�s��rJcCsjtjrtdur	dSz!t�ttj��}|�d�Wd�WdS1s#wYWdSty4YdSw)z2Return True if IPv6 is supported on this platform.NF)z::1rT)�socket�has_ipv6rr�bindr;)�sockr�r�r�rLs
���rLcCsxi}d}t}	|�d|�}||kr	|S|�d||�}||kr7|||�}||d|�}|r3|��}|||<|d}q)zCParse a C environ block of environment variables into a dictionary.rT�r�r~)r�find�upper)�datar�pos�WINDOWS_�next_pos�	equal_posr%r�r�r�r�rIs"��rIcC�$zt�|�WSty|YSw)z�Convert a numeric socket family value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    )r?�
AddressFamily�
ValueError��numr�r�r�rM7�
�rMcCrK)zConvert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    )r?�
SocketKindrMrNr�r�r�rNArPrNcCs�|tjthvr|r
t|�}|rt|�}|tjkr%|tthvr%|�|t�}nt}t|�}t|�}|dur<t	||||||�St
|||||||�S)z2Convert a raw connection tuple to a proper ntuple.N)r?rrr�r�getrrMrNr2r;)r��fam�type_r�r�r��
status_mapr�r�r�r�rUKsrUcCsxddl}|jr
|jsdS|jtjkr#t|j|j�d|j��dd�j�S|jtj	kr:t|j
|j�d|j��dd�j�SdS)zbGiven the address ntuple returned by ``net_if_addrs()``
    calculates the broadcast address.
    rN�/F)�strict)�	ipaddressr�r�r�r?r�str�IPv4Network�broadcast_addressr�IPv6Network)r�rXr�r�r��broadcast_addr^s$�����r]cs�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>|j�d��d��|jdur�|_t�|���fdd��}|S)Nz*() is deprecated and will be removed; use z
() insteadcs$tj�tdd�t|��|i|��S)Nr})�category�
stacklevel)�warnings�warn�DeprecationWarningr�)r�r#r$)r��replacementr�r��inner�sz/deprecated_method.<locals>.outer.<locals>.inner)rrr.r/)r)rd�rc)r�r��outerys��
z deprecated_method.<locals>.outerr�)rcrfr�rer�rFtsrFc@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_keysrr�r�r�r
�s

z_WrapNumbers.__init__cCsX||jvsJ�||jvsJ�||jvsJ�||j|<t�t�|j|<t�t�|j|<dSr)r(rkrlr��defaultdict�int�set)r��
input_dictr�r�r�r��	_add_dict�s
z_WrapNumbers._add_dictcCs\|j|}t|���t|���}|D]}|j||D]}|j||=q|j||=qdS)z�In case the number of keys changed between calls (e.g. a
        disk disappears) this removes the entry from self.reminders.
        N)r(ro�keysrlrk)r�rpr��old_dict�	gone_keys�gone_key�remkeyr�r�r��_remove_dead_reminders�s
�z#_WrapNumbers._remove_dead_remindersc
	Cs||jvr
|�||�|S|�||�|j|}i}|D]\}||}z||}Wn
ty5|||<Yqwg}tt|��D]3}	||	}
||	}||	f}|
|kre|j|||7<|j||�|�|�	|
|j||�q>t
|�||<q||j|<|S)zlCache dict and sum numbers which overflow and wrap.
        Return an updated copy of `input_dict`.
        )r(rqrwr!�range�lenrkrl�add�append�tuple)
r�rpr�rs�new_dictr%�input_tuple�	old_tuple�bits�i�input_value�	old_valuervr�r�r��run�s4

�
z_WrapNumbers.runNcCs�|j�:|dur|j��|j��|j��n|j�|d�|j�|d�|j�|d�Wd�dSWd�dS1s@wYdS)z>Clear the internal cache, optionally only for function 'name'.N)rjr(r+rkrl�pop)r�r�r�r�r�r,�s

�"�z_WrapNumbers.cache_clearcCs:|j�|j|j|jfWd�S1swYdS)z5Return internal cache dicts as a tuple of 3 elements.N)rjr(rkrlrr�r�r��
cache_info�s$�z_WrapNumbers.cache_infor)
rr�r�rr
rqrwr�r,r�r�r�r�r�rg�s
'rgcCs6tj�t�||�Wd�S1swYdS)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)�_wnrjr�)rpr�r�r�r�rO�s
$�rOi�cCst|dtd�S)N�rb)�	buffering)�open�FILE_READ_BUFFER_SIZE)�fnamer�r�r�rQ��rQcCsHt|tttd�}zt|_W|StyY|Sty#|���w)zaOpen a file in text mode by using the proper FS encoding and
    en/decoding error handlers.
    )r��encoding�errors)r�r�r0r1�_CHUNK_SIZEr1r"�close)r��fobjr�r�r�rPs ����rPcCs�|tur||��}|��Wd�S1swYdSz||��
}|��Wd�WS1s3wYWdStyE|YSw)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�readr;)r��fallback�_open�fr�r�r�rRs
$�
(��rRcCst||td�S)z,Same as above but opens file in binary mode.)r�r�)rRrQ)r�r�r�r�r�rS,srS�%(value).1f%(symbol)scCs�d}i}t|dd��D]\}}d|dd>||<qt|dd��D]}t|�||kr<t|�||}|t�Sq#|t|d|d�S)z�Used by various scripts. See: https://code.activestate.com/recipes/578019-bytes-to-human-human-to-bytes-converter/?in=user-4178764.

    >>> bytes2human(10000)
    '9.8K'
    >>> bytes2human(100001221)
    '95.4M'
    )	�B�K�M�G�T�P�E�Z�Yr~N�
r)�symbolr�)�	enumerate�reversed�absr�locals�dict)�nr��symbols�prefixr��sr�r�r�r�r�rT1s�rTcCstjdjS)z+Return updated psutil.PROCFS_PATH constant.r�)�sys�modules�PROCFS_PATHr�r�r�r��get_procfs_pathDr-r�cCs|jttd�S)N)r�r�)�decoder0r1)r�r�r�r�r�Ir�r�cCsXtjdkrdSzddl}|��sJ�|��|�d�dksJ�WdSty+YdSw)Nr[Tr�colorsF)r8r��curses�isatty�	setupterm�tigetnumr")�filer�r�r�r�rXRs
��rXFcCs�t�s|Sg}tddddddddd	d
�	}d|d<z||}Wnty6d
|�dt|�����}t|�d�w|�|�|rC|�d�dd�|��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�29N�invalid color z; choose amongst �1z[�;�mz)rXr�r!�listrrrMr{r�)r��color�bold�attrr�r�r�r�r�rWbs2�
�

rWc	Cst�st||d�dStrtt|||�|d�dSddl}d}|jjj}|jjj}t	ddddd�}||d<z||}Wnt
ySd	|�d
t|�����}	t
|	�d�w|r^|dkr^|d7}|tjurednd
}
|j|_||
�}|||�zt||d�W|||�dS|||�w)z$Print a colorized version of string.�r�rN�r}��)r�r�r�r�r�z; choose between �i�i����)rX�printrrW�ctypes�windll�Kernel32�GetStdHandle�SetConsoleTextAttributer�r!r�rrrMr��stderr�c_ulong�restype)r�r�r�r�r��
DEFAULT_COLORr�r�r�r��	handle_id�handler�r�r�rY~s:
�
��
�
rYcCsxtr:ddl}|�|��j�\}}}}}t|t�r(t|t�r#d|��}nd|��}td|�d|�d|��t	j
d�dSdS)z@If PSUTIL_DEBUG env var is set, print a debug message to stderr.rNz	ignoring zpsutil-debug [�:z]> r�)r�inspect�getframeinfo�currentframe�f_back�
isinstancer"r;r�r�r�)r�r�r��lineno�_�_lines�_indexr�r�r�rV�s�



��rVr)r�)NF)�rr��enumr.r8r?r9r�rhr`rrrrr�ImportErrorr�bool�getenvr�objectr��__all__r�rr�platform�
startswithrrrr	r
rr
r�AIXr&r'r#r(r*r.r"r,r-r$r%r+r)r/rrrrrrrrrrrr�IntEnumr|�globals�update�__members__r��getfilesystemencodingr0�getfilesystemencodeerrorsr1rCr?r=r>r@rDr;rArBr<r�r�r�r�r3r8r9r:r5r6r7r4r2r�rEr"r�rrrrrKrHr7rGrJrLrIrMrNrUr]rFrgrOr�r,r�r�rQrPrRrSrTr�r��stdoutrXrWrYrVr�r�r�r��<module>sB��
&
	�������	

�


�!
-G



W	

	

�(