U �=�_jf � N @ s8 d Z ddlmZmZ ddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlZddl mZ ddl mZ ddlmZ ddlmZ ddlmZ zdd lmZ W n ek r� dZY nX zdd lmZ W n ek r� dZY nX e jdk�rddlZndZe jd dkZd 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 G d�d�� d�ejE�ZFeG� �HeFjI� edk�r�d�ZJd�ZKn G d�d�� d�ejE�ZLeG� �HeLjI� e �M� ZNe�sd�ZOn2ze �P� ZOW n$ eQk �rH e�r@d�nd�ZOY nX edHd�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� G d�dۄ d�ek�ZlG d�d݄ d�el�ZmG d�d߄ d�em�ZnG d�d� d�el�ZoG d�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{G d�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�d dX�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-sleepZstoppedztracing-stopZzombieZdeadz wake-killZwakingZidle�lockedZwaitingZ suspendedZparkedZESTABLISHEDZSYN_SENTZSYN_RECVZ FIN_WAIT1Z FIN_WAIT2Z TIME_WAITZCLOSEZ CLOSE_WAITZLAST_ACKZLISTENZCLOSINGZNONE� � c @ s e Zd ZdZdZdZdS )� NicDuplexr^ r_ r N)�__name__� __module__�__qualname__r# r$ r% � rd rd �A/opt/alt/python38/lib64/python3.8/site-packages/psutil/_common.pyr` � s r` ������c @ s e Zd ZdZdZdS )�BatteryTimerf rg N)ra rb rc �POWER_TIME_UNKNOWN�POWER_TIME_UNLIMITEDrd rd rd re rh � s rh �replace�surrogateescape�total�usedZfreeZpercentZsinZsoutZ read_countZwrite_countZ read_bytesZwrite_bytesZ read_timeZ write_timeZdeviceZ mountpointZfstypeZoptsZmaxfileZmaxpathZ bytes_sentZ bytes_recvZpackets_sentZpackets_recvZerrinZerroutZdropinZdropout�nameZterminalZhostZstarted�pid�fdZfamily�type�laddr�raddr�statusZaddressZnetmaskZ broadcastZptpZisupZduplexZspeedZmtuZctx_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* e Zd ZdZdZd dd�Zdd� ZeZdS ) �ErrorzQBase exception class. All other psutil exceptions inherit from this one. �psutil� c C s t �| |� || _d S �N)� Exception�__init__�msg)�selfr� rd rd re r� s zError.__init__c C s d| j j| jf }|�� S )Nzpsutil.%s %s)� __class__ra r� �strip�r� �retrd rd re �__repr__ s zError.__repr__N)r� )ra rb rc �__doc__r� r� �__str__rd rd rd re r� s r� c @ s e Zd ZdZdZddd�ZdS )� NoSuchProcesszXException raised when a process with a certain PID doesn't or no longer exists. r� Nc C sX t �| |� || _|| _|| _|d krT|r@d| jt| j�f }n d| j }d| | _d S )N�(pid=%s, name=%s)�(pid=%s)zprocess no longer exists �r� r� rp ro r� �repr)r� rp ro r� �detailsrd rd re r� ' s zNoSuchProcess.__init__)NN�ra rb rc r� r� rd rd rd re r� ! s r� c @ s e Zd ZdZdZddd�ZdS )� 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 C s~ t �| |� || _|| _|| _|| _|d krzd| g}|rN|�dt| j� � |rb|�d| j � dd�|� }d| | _d S )Nzpid=%szname=%szppid=%sz(%s)z, z'process still exists but it's a zombie ) r� r� rp �ppidro r� �appendr� �join)r� rp ro r� r� �argsr� rd rd re r� = s zZombieProcess.__init__)NNNr� rd rd rd re r� 4 s r� c @ s e Zd ZdZdZddd�ZdS )�AccessDeniedz@Exception raised when permission to perform an action is denied.r� Nc C sj t �| |� || _|| _|| _|d krf|d k rJ|d k rJd|t|�f | _n|d k r`d| j | _nd| _d S )Nr� r� r� r� )r� rp ro r� rd rd re r� Q s zAccessDenied.__init__)NNNr� rd rd rd re r� M s r� c @ s e Zd ZdZdZddd�ZdS )�TimeoutExpiredzWRaised on Process.wait(timeout) if timeout expires and process is still alive. r� Nc C sn t �| d| � || _|| _|| _|d k rN|d k rN| jd|t|�f 7 _n|d k rj| jd| j 7 _d S )Nztimeout after %s secondsz (pid=%s, name=%s)z (pid=%s))r� r� �secondsrp ro r� r� )r� r� rp ro rd rd re r� e s zTimeoutExpired.__init__)NNr� rd rd rd re r� _ s r� c C sF zt | �| d }W n tk r* Y dS X |dk r>t||�}|S dS )z5Calculate percentage usage of 'used' against 'total'.�d g N)�float�ZeroDivisionError�round)rn rm Zround_r� rd rd re rO u s c s2 t ���� �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() >>> c sN | t t|�� ��f}z � | W S tk rH �| |� }� |<