HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib64/python3.7/site-packages/psutil/__pycache__/_common.cpython-37.pyc
B

�=�_jf�N@s8dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddl
mZddlmZddlmZddlmZydd	lmZWnek
r�dZYnXydd
lmZWnek
r�dZYnXe
jdk�rddlZndZe
jddkZd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZgNZejd[kZejd\kZe
j�d]�Ze
j�d^�Z e Z!e
j�d_�Z"e
j�d`�Z#e
j�da�Z$e"�pe#�pe$Z%e
j�db�Z&e
j�dc�Z'ddZ(deZ)dfZ*dgZ+dhZ,diZ-djZ.dkZ/dlZ0dmZ1dnZ2doZ3dpZ4dqZ5drZ6dsZ7dtZ8duZ9dvZ:dwZ;dxZ<dyZ=dzZ>d{Z?d|Z@d}ZAedk�r�d~ZBdZCdZDn Gd�d��d�ejE�ZFeG��HeFjI�edk�r�d�ZJd�ZKn Gd�d��d�ejE�ZLeG��HeLjI�e
�M�ZNe�sd�ZOn2ye
�P�ZOWn$eQk
�rHe�r@d�nd�ZOYnXedHd�d�d�d�d�d�g�ZRedDd�d�d�d�g�ZSedBd�d�d�d�d�d�g�ZTedCd�d�d�d�d�d�g�ZUedEd�d�d�d�d�d�d�d�g�ZVedId�d�d�d�d�g�ZWed@d�d�d�d�d�d�d�g�ZXedFd�d�d�d�d�g�ZYedGd�d�d�d�g�ZZedAd�d�d�d�g�Z[ed�d�d�d�g�Z\ed�d�d�d�d�g�Z]ed�d�d�d�g�Z^ed�d�d�g�Z_ed8d�d�d�d�g�Z`ed=d�d�g�Zaed>d�d�d�g�Zbed?d�d�d�g�Zced:d�d�d�g�Zded;d�d�d�d�g�Zeed<d�d�g�Zfed9d�d�g�Zged7d�d�d�d�d�d�g�Zhed�d�d�g�ZieeegeegfeegegfegegfeegegfegegfeegeegfegeegfegeegfdלZjedk	�r�ej�Hegegfegegfd؜�edk	�r�ej�Hd�egeegfi�Gd�dۄd�ek�ZlGd�d݄d�el�ZmGd�d߄d�em�ZnGd�d�d�el�ZoGd�d�d�el�Zp�dd�dP�Zqd�dM�Zrd�d�Zsd�dL�Ztd�dO�Zuerd�dQ��Zvd�dN�Zwd�dR�Zxd�dS�Zy�dd�dV�Zzd�dK�Z{Gd�d�d�Z|d�dT�Z}e|�Z~e~je}_e~j�e}_�d�d�Z�d�d��Z��dd�dU�Z�d�d��Z�e�r�d�d��Z�nd�d��Z�ere
j�fd�dY��Z��d�ddX�Z�dd�e
j�f�ddZ�Z�e�e���dd���r*ddl�Z��ddW�Z�n
�ddW�Z�dS(	z9Common objects shared by __init__.py and _ps*.py modules.�)�division�print_functionN)�defaultdict)�
namedtuple)�AF_INET)�
SOCK_DGRAM)�SOCK_STREAM)�AF_INET6)�AF_UNIX)��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�bytes2human�conn_to_ntuple�debug�hilite�term_supports_colors�print_color�posix�ntZlinux�darwinZfreebsdZopenbsdZnetbsd)ZsunosZsolarisZaixZrunningZsleepingz
disk-sleepZstoppedztracing-stopZzombieZdeadz	wake-killZwakingZidle�lockedZwaitingZ	suspendedZparkedZESTABLISHEDZSYN_SENTZSYN_RECVZ	FIN_WAIT1Z	FIN_WAIT2Z	TIME_WAITZCLOSEZ
CLOSE_WAITZLAST_ACKZLISTENZCLOSINGZNONE��c@seZdZdZdZdZdS)�	NicDuplexr^r_rN)�__name__�
__module__�__qualname__r#r$r%�rdrd�A/opt/alt/python37/lib64/python3.7/site-packages/psutil/_common.pyr`�sr`������c@seZdZdZdZdS)�BatteryTimerfrgN)rarbrc�POWER_TIME_UNKNOWN�POWER_TIME_UNLIMITEDrdrdrdrerh�srh�replace�surrogateescape�total�usedZfreeZpercentZsinZsoutZ
read_countZwrite_countZ
read_bytesZwrite_bytesZ	read_timeZ
write_timeZdeviceZ
mountpointZfstypeZoptsZmaxfileZmaxpathZ
bytes_sentZ
bytes_recvZpackets_sentZpackets_recvZerrinZerroutZdropinZdropout�nameZterminalZhostZstarted�pid�fdZfamily�type�laddr�raddr�statusZaddressZnetmaskZ	broadcastZptpZisupZduplexZspeedZmtuZctx_switchesZ
interruptsZsoft_interruptsZsyscalls�scpufreqZcurrent�min�max�shwtempZlabelZhighZcritical�sbatteryZsecsleftZ
power_plugged�sfan�user�system�
children_user�children_system�path�idZ	user_timeZsystem_time�realZ	effectiveZsavedZioclass�valueZ	voluntaryZinvoluntary�addrZipZport)�allZtcpZtcp4ZudpZudp4ZinetZinet4Zinet6)Ztcp6Zudp6Zunixc@s*eZdZdZdZd	dd�Zdd�ZeZdS)
�ErrorzQBase exception class. All other psutil exceptions inherit
    from this one.
    �psutil�cCst�||�||_dS)N)�	Exception�__init__�msg)�selfr�rdrdrer�szError.__init__cCsd|jj|jf}|��S)Nzpsutil.%s %s)�	__class__rar��strip)r��retrdrdre�__repr__szError.__repr__N)r�)rarbrc�__doc__r�r��__str__rdrdrdrer�s

r�c@seZdZdZdZddd�ZdS)�
NoSuchProcesszXException raised when a process with a certain PID doesn't
    or no longer exists.
    r�NcCsXt�||�||_||_||_|dkrT|r@d|jt|j�f}n
d|j}d||_dS)Nz(pid=%s, name=%s)z(pid=%s)zprocess no longer exists )r�r�rpror��repr)r�rpror��detailsrdrdrer�'s
zNoSuchProcess.__init__)NN)rarbrcr�r�rdrdrdrer�!sr�c@seZdZdZdZddd�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�||�||_||_||_||_|dkrzd|g}|rN|�dt|j��|rb|�d|j�dd�|�}d||_dS)Nzpid=%szname=%szppid=%sz(%s)z, z'process still exists but it's a zombie )	r�r�rp�ppidror��appendr��join)r�rpror�r��argsr�rdrdrer�=s
zZombieProcess.__init__)NNN)rarbrcr�r�rdrdrdrer�4sr�c@seZdZdZdZddd�ZdS)�AccessDeniedz@Exception raised when permission to perform an action is denied.r�NcCsjt�||�||_||_||_|dkrf|dk	rJ|dk	rJd|t|�f|_n|dk	r`d|j|_nd|_dS)Nz(pid=%s, name=%s)z(pid=%s)r�)r�r�rpror�r�)r�rpror�rdrdrer�QszAccessDenied.__init__)NNN)rarbrcr�r�rdrdrdrer�Msr�c@seZdZdZdZddd�ZdS)�TimeoutExpiredzWRaised on Process.wait(timeout) if timeout expires and process
    is still alive.
    r�NcCsnt�|d|�||_||_||_|dk	rN|dk	rN|jd|t|�f7_n|dk	rj|jd|j7_dS)Nztimeout after %s secondsz (pid=%s, name=%s)z	 (pid=%s))r�r��secondsrpror�r�)r�r�rprordrdrer�eszTimeoutExpired.__init__)NN)rarbrcr�r�rdrdrdrer�_sr�cCsDyt|�|d}Wntk
r(dSX|dk	r<t||�}|SdS)z5Calculate percentage usage of 'used' against 'total'.�dgN)�float�ZeroDivisionError�round)rnrmZround_r�rdrdrerOus
cs2t�����fdd��}�fdd�}i�||_|S)aA 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()
    >>>
    csH|tt|����f}y�|Stk
rB�||�}�|<|SXdS)N)�	frozenset�sorted�items�KeyError)r��kwargs�keyr�)�cache�funrdre�wrapper�szmemoize.<locals>.wrappercs���dS)zClear cache.N)�clearrd)r�rdre�cache_clear�szmemoize.<locals>.cache_clear)�	functools�wrapsr�)r�r�r�rd)r�r�rerL�s
	cs6t����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()
    >>>
    csPy|j�}Wn<tk
r&�|�Stk
rJ�|�}|j�<YnX|S)N)�_cache�AttributeErrorr�)r�r�)r�rdrer��sz'memoize_when_activated.<locals>.wrappercSs
i|_dS)zjActivate cache. Expects a Process instance. Cache will be
        stored as a "_cache" instance attribute.N)r�)�procrdrdre�cache_activate�sz.memoize_when_activated.<locals>.cache_activatecSs"y|`Wntk
rYnXdS)zDeactivate and clear cache.N)r�r�)r�rdrdre�cache_deactivate�sz0memoize_when_activated.<locals>.cache_deactivate)r�r�r�r�)r�r�r�r�rd)r�re�memoize_when_activated�sr�c
CsVyt�|�}Wn6tk
rD}z|jtjtjfkr4�dSd}~XYnXt�|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
    FN)�os�stat�OSError�errno�EPERM�EACCES�S_ISREG�st_mode)r��st�errrdrdrerK�sc
CsNyt�|�Wn6tk
rD}z|jtjtjfkr4�dSd}~XYnXdSdS)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
    FNT)r�r�r�r�r�r�)r�r�rdrdrerN�sc	Cs`tjrtdkrdSy2t�ttj�}t�|��|�d�WdQRXdStjk
rZdSXdS)z2Return True if IPv6 is supported on this platform.NF)z::1rT)�socketZhas_ipv6r	r�
contextlib�closingZbind�error)ZsockrdrdrerP�scCszi}d}t}xh|�d|�}||kr$P|�d||�}||krj|||�}||d|�}|rb|��}|||<|d}qW|S)zCParse a C environ block of environment variables into a dictionary.r��=r_)r�find�upper)�datar��posZWINDOWS_Znext_posZ	equal_posr�r�rdrdrerMs cCs0tdkr|Sy
t�|�Stk
r*|SXdS)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�Z
AddressFamily�
ValueError)�numrdrdrerQ"s
cCs0tdkr|Sy
t�|�Stk
r*|SXdS)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�Z
SocketKindr�)r�rdrdrerR/s
cCs�|tjtfkr&|rt|�}|r&t|�}|tjkrJ|ttfkrJ|�|t�}nt}t|�}t|�}|dkrxt	||||||�St
|||||||�SdS)z2Convert a raw connection tuple to a proper ntuple.N)r�rr	r�r�getrrQrRr6r?)rqZfamZtype_rsrtruZ
status_maprprdrdrerU<scs�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�|jdkr�|_t�|���fdd��}|S)Nz8%s() is deprecated and will be removed; use %s() insteadcs tj�tdd�t|��||�S)Nr^)�category�
stacklevel)�warnings�warn�DeprecationWarning�getattr)r�r�r�)r��replacementrdre�innerYsz/deprecated_method.<locals>.outer.<locals>.inner)rar�r�r�)r�r�)r�)r�re�outerSs
z deprecated_method.<locals>.outerrd)r�r�rd)r�rerJOsc@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|_dS)N)�	threadingZLock�lockr��	reminders�
reminder_keys)r�rdrdrer�fs
z_WrapNumbers.__init__cCsT||jkst�||jkst�||jks*t�||j|<tt�|j|<tt�|j|<dS)N)r��AssertionErrorr�r�r�int�set)r��
input_dictrordrdre�	_add_dictls
z_WrapNumbers._add_dictcCsd|j|}t|���t|���}x<|D]4}x"|j||D]}|j||=q<W|j||=q(WdS)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�ro�old_dictZ	gone_keysZgone_key�remkeyrdrdre�_remove_dead_remindersts

z#_WrapNumbers._remove_dead_remindersc
	Cs||jkr|�||�|S|�||�|j|}i}x�|��D]�}||}y||}Wntk
rt|||<w>YnXg}xvtt|��D]f}	||	}
||	}||	f}|
|kr�|j|||7<|j||�	|�|�
|
|j||�q�Wt|�||<q>W||j|<|S)zkCache dict and sum numbers which overflow and wrap.
        Return an updated copy of `input_dict`
        )r�r�r�r�r��range�lenr�r��addr��tuple)
r�r�ror�Znew_dictr�Zinput_tupleZ	old_tuple�bits�iZinput_value�	old_valuer�rdrdre�runs2


z_WrapNumbers.runNc	Csh|j�X|dkr0|j��|j��|j��n*|j�|d�|j�|d�|j�|d�WdQRXdS)z>Clear the internal cache, optionally only for function 'name'.N)r�r�r�r�r��pop)r�rordrdrer��s

z_WrapNumbers.cache_clearc	Cs"|j�|j|j|jfSQRXdS)z5Return internal cache dicts as a tuple of 3 elements.N)r�r�r�r�)r�rdrdre�
cache_info�sz_WrapNumbers.cache_info)N)
rarbrcr�r�r�r�r�r�r�rdrdrdrer�as'
r�c	Cstj�t�||�SQRXdS)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)�_wnr�r�)r�rordrdrerS�scKst|df|�S)N�rb)�open)�fnamer�rdrdre�open_binary�sr�cKs*tr|�dt�|�dt�t|df|�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').
    �encoding�errorsZrt)�PY3�
setdefaultr4r5r�)r�r�rdrdre�	open_text�sr��%(value).1f%(symbol)scCs�d}i}x0t|dd��D]\}}d|dd>||<qWx>t|dd��D]*}|||krLt|�||}|t�SqLW|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�Yr_N�
r)�symbolr�)�	enumerate�reversedr��locals�dict)�n�formatZsymbols�prefixr��srr�rdrdrerT�s	cCstjdjS)z+Return updated psutil.PROCFS_PATH constant.r�)�sys�modulesZPROCFS_PATHrdrdrdre�get_procfs_path�srcCs|jttd�S)N)r�r�)�decoder4r5)rrdrdrer�srcCs|S)Nrd)rrdrdrer�scCs^tjdkrdSy2ddl}|��s$t�|��|�d�dks>t�Wntk
rTdSXdSdS)Nr[Tr�colorsF)r�ro�curses�isattyr�Z	setuptermZtigetnumr�)�filerrdrdrerX�s
FcCs�t�s
|Sg}tddddddddd	d
�	}d|d<y||}Wn(tk
rdtd
t|�����YnX|�|�|r~|�d�dd�|�|fS)z*Return an highlighted version of 'string'.Z32Z91Z33Z93Z34Z35Z36Z37Z30)	�green�red�brown�yellowZblueZvioletZ	lightblueZgreyZdarkgreyZ29Nz#invalid color %r; choose between %s�1z[%sm%s�;)rXrr�r��listr�r�r�)r�color�bold�attrrrdrdrerW
s

c	Cst�st||d�n�tr.tt|||�|d�n�ddl}d}|jjj}|jjj}t	ddddd�}||d<y||}Wn,t
k
r�td	|t|�
��f��YnX|r�|dkr�|d
7}|tjkr�dnd}	|j|_||	�}
||
|�zt||d�Wd||
|�XdS)
z$Print a colorized version of string.)rrN�r^r�)rrrrz#invalid color %r; choose between %r�i�i����)rX�printrrW�ctypesZwindllZKernel32�GetStdHandle�SetConsoleTextAttributerr�r�rr�r�stderrZc_ulongZrestype)rrrrr"Z
DEFAULT_COLORr#r$rZ	handle_idZhandlerdrdrerY s0


ZPSUTIL_DEBUGcCs6t�t��j�\}}}}}td|||ftjd�dS)z@If PSUTIL_DEBUG env var is set, print a debug message to stderr.zpsutil-debug [%s:%s]> %s)rN)�inspectZgetframeinfoZcurrentframe�f_backr!rr%)r�r��linenoZ	func_name�lines�indexrdrdrerVFscCsdS)Nrd)r�rdrdrerVMs)N)N)r�)NF)�r�Z
__future__rrr�r�r�r�r�r�rr�r��collectionsrrrrrr	�ImportErrorr
�version_infor�r��__all__rorr�platform�
startswithrrrr
rrrrZAIXr*r+r'r,r.r2r&r0r1r(r)r/r-r3rr!r rrr"rrrrrrr#r$r%�IntEnumr`�globals�update�__members__rirjrh�getfilesystemencodingr4r5�getfilesystemencodeerrorsr�rGrCrArBrDrHr?rErFr@rvryrzr{r7r<r=r>r9r:r;r8r6r�rIr�r�r�r�r�r�rOrLr�rKrNrPrMrQrRrUrJr�rSr�r�r�r�r�rTrr�stdoutrXrWrY�bool�getenvr&rVrdrdrdre�<module>s|



	

	







	




	 9

W	
	"