관리-도구
편집 파일: _common.cpython-36.pyc
3 ��JZ�E � V @ s. d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlm Z ddlmZ ddlmZ ddlmZ ddlmZ ydd lmZ W n ek r� dZY nX ydd lmZ W n ek r� dZY nX e jd�k� r�ddlZndZe 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@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRgFZejdSkZejdTkZe jjdU�Ze jjdV�Ze jjdW�Z e jjdX�Z!e jjdY�Z"e �p�e!�p�e"Z#e jjdZ��pe jjd[�Z$e jjd\�Z%d]Z&d^Z'd_Z(d`Z)daZ*dbZ+dcZ,ddZ-deZ.dfZ/dgZ0dhZ1diZ2djZ3dkZ4dlZ5dmZ6dnZ7doZ8dpZ9dqZ:drZ;dsZ<dtZ=duZ>edk�r�dvZ?dwZ@dZAn G dxdy� dyejB�ZCeD� jEeCjF� edk�r�d�ZGd�ZHn G dzd{� d{ejB�ZIeD� jEeIjF� e jJ� ZKe�s d|ZLn2ye jM� ZLW n$ eNk �r: e�r2d}nd|ZLY nX edFd~dd�d�d�d�g�ZOedBd~dd�d�g�ZPed@d�d�d�d�d�d�g�ZQedAd�d�d�d�g�ZRedCd�d�d�d�d�d�d�d�g�ZSedGd�d�d�d�d�g�ZTed>d�d�d�d�d�d�d�g�ZUedDd�d�d�d�d�g�ZVedEd�d�d�d�g�ZWed?d�d�d�d�g�ZXed�d�d�d�g�ZYed�d�d�d�d�g�ZZed�d�d�d�g�Z[ed�d�d�g�Z\ed6d�d�d�d�g�Z]ed;d�d�g�Z^ed<d�d�d�g�Z_ed=d�d�d�g�Z`ed8d�d�d�g�Zaed9d�d�d�d�g�Zbed:d�d�g�Zced7d�d�g�Zded5d�d�d�d�d�d�g�Zeed�d�d�g�Zfeeegeegfeegegfegegfeegegfegegfeegeegfegeegfegeegfd˜Zgedk �r~egjEegegfegegfd̜� edk �r�egjEd�egeegfi� [[[[d�d�dN�Zhd�dK� Zid�dф Zjd�dJ� Zkd�dM� Zleid�dO� �Zmd�dL� Znd�dP� Zod�dQ� Zpd�dI� ZqG d�dڄ dڃZrd�dR� Zser� Ztetjues_uetjves_vdS )�z9Common objects shared by __init__.py and _ps*.py modules.� )�divisionN)�defaultdict)� namedtuple)�AF_INET)� SOCK_DGRAM)�SOCK_STREAM)�AF_INET6)�AF_UNIX� � �FREEBSD�BSD�LINUX�NETBSD�OPENBSD�OSX�POSIX�SUNOS�WINDOWS�ENCODING� ENCODING_ERRSr � 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�pconn� pcputimes�pctxsw�pgids�pio�pionice� popenfile�pthread�puids�sconn� scpustats�sdiskio� sdiskpart� sdiskusage�snetio�snic� 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�posix�nt�linux�darwinZfreebsdZopenbsdZnetbsd�sunos�solaris�aixZrunningZsleepingz disk-sleepZstoppedztracing-stopZzombieZdeadz wake-killZwakingZidle�lockedZwaitingZ suspendedZESTABLISHEDZSYN_SENTZSYN_RECVZ FIN_WAIT1Z FIN_WAIT2Z TIME_WAITZCLOSEZ CLOSE_WAITZLAST_ACKZLISTENZCLOSINGZNONE� � c @ s e Zd ZdZdZdZdS )� NicDuplexrY rZ r N)�__name__� __module__�__qualname__r# r$ r% � r_ r_ �/usr/lib64/python3.6/_common.pyr[ s r[ c @ s e Zd ZdZdZdS )�BatteryTimerZ rY N������)r\ r] r^ �POWER_TIME_UNKNOWN�POWER_TIME_UNLIMITEDr_ r_ r_ r` ra � s ra �replace�surrogateescape�total�usedZfreeZpercentZsinZsoutZ read_countZwrite_countZ read_bytesZwrite_bytesZ read_timeZ write_timeZdeviceZ mountpointZfstypeZoptsZ bytes_sentZ bytes_recvZpackets_sentZpackets_recvZerrinZerroutZdropinZdropout�nameZterminal�hostZstarted�pid�fdZfamily�typeZladdrZraddrZstatusZaddressZnetmaskZ 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 C s\ y| | d }W n0 t k r@ t| t�s4t|t�r8dnd}Y nX |dk rTt||�S |S dS )z5Calculate percentage usage of 'used' against 'total'.�d g r N)�ZeroDivisionError� isinstance�float�round)ri rh Z_round�retr_ r_ r` rL s " c s2 t j��� �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 sH | t t|j� ��f}y� | S tk rB �| |� }� |<