name : _common.pyc
�
Ҿ�\cI@ s"	dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZddlmZddlmZydd	lmZWnek
r�dZnXydd
lmZWnek
r-dZnXe	jd�krLddlZndZe	jd
dkZddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVgIZejdWkZejdXkZe	jjdY�Ze	jjdZ�Z e Z!e	jjd[�Z"e	jjd\�Z#e	jjd]�Z$e"p�e#p�e$Z%e	jjd��Z&e	jjd`�Z'daZ(dbZ)dcZ*ddZ+deZ,dfZ-dgZ.dhZ/diZ0djZ1dkZ2dlZ3dmZ4dnZ5doZ6dpZ7dqZ8drZ9dsZ:dtZ;duZ<dvZ=dwZ>dxZ?dyZ@dzZAedkr�d{ZBd|ZCd
ZDn,d}ejEfd~��YZFeG�jHeFjI�edkr�dZJdZKn,d�ejEfd���YZLeG�jHeLjI�e	jM�ZNesEd�ZOn6ye	jP�ZOWn#eQk
rzerqd�nd�ZOnXedId�d�d�d�d�d�g�ZRedEd�d�d�d�g�ZSedCd�d�d�d�d�d�g�ZTedDd�d�d�d�g�ZUedFd�d�d�d�d�d�d�d�g�ZVedJd�d�d�d�d�g�ZWedAd�d�d�d�d�d�d�g�ZXedGd�d�d�d�d�g�ZYedHd�d�d�d�g�ZZedBd�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_ed9d�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�Zfed:d�d�g�Zged8d�d�d�d�d�d�g�Zhed�d�d�g�Ziieeegeegfd�6eegegfd�6egegfd�6eegegfd�6egegfd�6eegeegfd�6egeegfd�6egeegfd�6Zjedk	r�ejjHiegegfd�6egegfd�6�nedk	r0ejjHiegeegfd�6�n[[[[dd��Zkd��Zld��Zmd��Znd��Zoeld���Zpd��Zqd��Zrd��Zsd��Ztd�d�d���YZud��Zveu�Zwewjxev_xewjyev_yd��Zzd��Z{d�d��Z|d��Z}er	d��Z~n	d��Z~dS(�s9Common objects shared by __init__.py and _ps*.py modules.i����(tdivisionN(tdefaultdict(t
namedtuple(tAF_INET(t
SOCK_DGRAM(tSOCK_STREAM(tAF_INET6(tAF_UNIXiiitFREEBSDtBSDtLINUXtNETBSDtOPENBSDtMACOStOSXtPOSIXtSUNOStWINDOWStENCODINGt
ENCODING_ERRSRt
CONN_CLOSEtCONN_CLOSE_WAITtCONN_CLOSINGtCONN_ESTABLISHEDtCONN_FIN_WAIT1tCONN_FIN_WAIT2t
CONN_LAST_ACKtCONN_LISTENt	CONN_NONEt
CONN_SYN_RECVt
CONN_SYN_SENTtCONN_TIME_WAITtNIC_DUPLEX_FULLtNIC_DUPLEX_HALFtNIC_DUPLEX_UNKNOWNtSTATUS_DEADtSTATUS_DISK_SLEEPtSTATUS_IDLEt
STATUS_LOCKEDtSTATUS_RUNNINGtSTATUS_SLEEPINGtSTATUS_STOPPEDtSTATUS_SUSPENDEDtSTATUS_TRACING_STOPtSTATUS_WAITINGtSTATUS_WAKE_KILLt
STATUS_WAKINGt
STATUS_ZOMBIEt
STATUS_PARKEDtpconnt	pcputimestpctxswtpgidstpiotpionicet	popenfiletpthreadtpuidstsconnt	scpustatstsdiskiot	sdiskpartt
sdiskusagetsnetiotsnicaddrt	snicstatstsswaptsusert	conn_tmaptdeprecated_methodt
isfile_stricttmemoizetparse_environ_blocktpath_exists_strictt
usage_percentt
supports_ipv6tsockfam_to_enumtsocktype_to_enumtwrap_numberstbytes2humantposixtnttlinuxtdarwintfreebsdtopenbsdtnetbsdtsunostsolaristaixtrunningtsleepings
disk-sleeptstoppedstracing-stoptzombietdeads	wake-killtwakingtidletlockedtwaitingt	suspendedtparkedtESTABLISHEDtSYN_SENTtSYN_RECVt	FIN_WAIT1t	FIN_WAIT2t	TIME_WAITtCLOSEt
CLOSE_WAITtLAST_ACKtLISTENtCLOSINGtNONEiit	NicDuplexcB seZdZdZdZRS(iii(t__name__t
__module__R R!R"(((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRq�si����tBatteryTimecB seZdZdZRS(i����i����(RrRstPOWER_TIME_UNKNOWNtPOWER_TIME_UNLIMITED(((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRt�streplacetsurrogateescapettotaltusedtfreetpercenttsintsoutt
read_counttwrite_countt
read_bytestwrite_bytest	read_timet
write_timetdevicet
mountpointtfstypetoptst
bytes_sentt
bytes_recvtpackets_senttpackets_recvterrinterrouttdropintdropouttnametterminalthosttstartedtpidtfdtfamilyttypetladdrtraddrtstatustaddresstnetmaskt	broadcasttptptisuptduplextspeedtmtutctx_switchest
interruptstsoft_interruptstsyscallstscpufreqtcurrenttmintmaxtshwtemptlabelthightcriticaltsbatterytsecsleftt
power_pluggedtsfantusertsystemt
children_usertchildren_systemtpathtidt	user_timetsystem_timetrealt	effectivetsavedtioclasstvaluet	voluntarytinvoluntarytaddrtiptporttallttcpttcp4tudptudp4tinettinet4tinet6ttcp6tudp6tunixcC sqy||d}Wn;tk
rOt|t�s@t|t�rFdnd}nX|dk	rit||�S|SdS(s5Calculate percentage usage of 'used' against 'total'.idgiN(tZeroDivisionErrort
isinstancetfloattNonetround(RzRytround_tret((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRJs
.
c sCtj����fd��}�fd�}i�||_|S(sA 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 sZ|tt|j���f}y�|SWn)tk
rU�||�}�|<|SXdS(N(t	frozensettsortedtitemstKeyError(targstkwargstkeyR�(tcachetfun(sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytwrapper&s
c s�j�dS(sClear cache.N(tclear((R�(sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytcache_clear/s(t	functoolstwrapsR�(R�R�R�((R�R�sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRGs
!		c sFtj���fd��}d�}d�}||_||_|S(s�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 sWy|j�}Wn?tk
r+�|�Stk
rR�|�}|j�<nX|S(N(t_cachetAttributeErrorR�(tselfR�(R�(sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyR�Rs


cS s
i|_dS(sjActivate cache. Expects a Process instance. Cache will be
        stored as a "_cache" instance attribute.N(R�(tproc((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytcache_activate`scS s"y
|`Wntk
rnXdS(sDeactivate and clear cache.N(R�R�(R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytcache_deactivatees

(R�R�R�R�(R�R�R�R�((R�sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytmemoize_when_activated8s				cC s_ytj|�}Wn5tk
rJ}|jtjtjfkrF�ntSXtj|j�SdS(s�Same as os.path.isfile() but does not swallow EACCES / EPERM
    exceptions, see:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html
    N(	toststattOSErrorterrnotEPERMtEACCEStFalsetS_ISREGtst_mode(R�tstterr((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRFqscC sQytj|�Wn5tk
rH}|jtjtjfkrD�ntSXtSdS(s�Same as os.path.exists() but does not swallow EACCES / EPERM
    exceptions, see:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html
    N(R�R�R�R�R�R�R�tTrue(R�R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRI�scC svtjstdkrtSy@tjttj�}tj|��|jd�WdQXt	SWntj
k
rqtSXdS(s2Return True if IPv6 is supported on this platform.s::1iN(s::1i(tsocketthas_ipv6RR�R�Rt
contextlibtclosingtbindR�terror(tsock((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRK�scC s�i}d}t}x�tr�|jd|�}||kr=Pn|jd||�}||kr�|||!}||d|!}|r�|j�}n|||<n|d}qW|S(sCParse a C environ block of environment variables into a dictionary.ist=i(RR�tfindtupper(tdataR�tpostWINDOWS_tnext_post	equal_posR�R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRH�s 	

cC s@tdkr|Sytj|�SWnttfk
r;|SXdS(s�Convert a numeric socket family value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N(tenumR�R�t
AddressFamilyt
ValueErrorR�(tnum((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRL�scC s@tdkr|Sytj|�SWnttfk
r;|SXdS(sConvert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N(RR�R�tAddressTypeR
R�(R((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRM�sc s�fd�}|S(s�A decorator which can be used to mark a method as deprecated
    'replcement' is the method name which will be called instead.
    c sSd|j�f�|jdkr.�|_ntj|���fd��}|S(Ns8%s() is deprecated and will be removed; use %s() insteadc s/tj�dtdd�t|��||�S(Ntcategoryt
stackleveli(twarningstwarntDeprecationWarningtgetattr(R�R�R�(tmsgtreplacement(sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytinner�s(Rrt__doc__R�R�R�(R�R(R(RsOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytouter�s!((RR((RsOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRE�st_WrapNumberscB sGeZdZd�Zd�Zd�Zd�Zdd�Zd�Z	RS(sNWatches numbers so that they don't overflow and wrap
    (reset to zero).
    cC s.tj�|_i|_i|_i|_dS(N(t	threadingtLocktlockR�t	reminderst
reminder_keys(R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyt__init__�s		cC sv||jkst�||jks*t�||jks?t�||j|<tt�|j|<tt�|j|<dS(N(R�tAssertionErrorRRRtinttset(R�t
input_dictR�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyt	_add_dict�s
cC s||j|}t|j��t|j��}xF|D]>}x'|j||D]}|j||=qNW|j||=q6WdS(s�In case the number of keys changed between calls (e.g. a
        disk disappears) this removes the entry from self.reminders.
        N(R�R!tkeysRR(R�R"R�told_dictt	gone_keystgone_keytremkey((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyt_remove_dead_reminders�s
"
c
C sT||jkr#|j||�|S|j||�|j|}i}x�|j�D]�}||}y||}Wntk
r�|||<qSnXg}x�tt|��D]�}	||	}
||	}||	f}|
|kr|j||c|7<|j||j	|�n|j
|
|j||�q�Wt|�||<qSW||j|<|S(skCache dict and sum numbers which overflow and wrap.
        Return an updated copy of `input_dict`
        (R�R#R)R$R�trangetlenRRtaddtappendttuple(
R�R"R�R%tnew_dictR�tinput_tuplet	old_tupletbitstitinput_valuet	old_valueR(((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytruns2





 
cC s�|j�t|dkr@|jj�|jj�|jj�n9|jj|d�|jj|d�|jj|d�WdQXdS(s>Clear the internal cache, optionally only for function 'name'.N(RR�R�R�RRtpop(R�R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyR�*s


cC s*|j�|j|j|jfSWdQXdS(s5Return internal cache dicts as a tuple of 3 elements.N(RR�RR(R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyt
cache_info6s
N(
RrRsRRR#R)R6R�R�R8(((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyR�s				'cC s$tj�tj||�SWdQXdS(s�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(t_wnRR6(R"R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRN<s
cK st|d|�S(Ntrb(topen(tfnameR�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytopen_binaryJscK s9tr)|jdt�|jdt�nt|d|�S(s�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').
    tencodingterrorstrt(tPY3t
setdefaultRRR;(R<R�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyt	open_textNss%(value).1f%(symbol)sc	C s�d}i}x4t|d
�D]"\}}d
|d
d>||<qWxGt|d
�D]5}|||krTt|�||}|t�SqTW|td|d
d|�S(s�Used by various scripts. See:
    http://goo.gl/zeJZl

    >>> bytes2human(10000)
    '9.8K'
    >>> bytes2human(100001221)
    '95.4M'
    tBtKtMtGtTtPtEtZtYii
tsymboliR�(	RDRERFRGRHRIRJRKRL(t	enumeratetreversedR�tlocalstdict(tntformattsymbolstprefixR3tsRMR�((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyRO\s	cC stjdjS(s+Return updated psutil.PROCFS_PATH constant.tpsutil(tsystmodulestPROCFS_PATH(((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pytget_procfs_pathpscC s|jdtdt�S(NR>R?(tdecodeRR(RV((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyR\vscC s|S(N((RV((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyR\ys(ii(RWRX((Rt
__future__RR�R�R�R�R�R�RXRRtcollectionsRRRRRRtImportErrorR�Rtversion_infoRRAt__all__R�RRtplatformt
startswithR
R
RRRRR	RtAIXR'R(R$R)R+R/R#R-R.R%R&R,R*R0RRRRRRRRRRRRR R!R"tIntEnumRqtglobalstupdatet__members__RuRvRttgetfilesystemencodingRRtgetfilesystemencodeerrorsR�RBR>R<R=R?RCR:R@RAR;R�R�R�R�R2R7R8R9R4R5R6R3R1R�RDRJRGR�RFRIRKRHRLRMRERRNR9R�R8R=RCROR[R\(((sOC:/Program Files (x86)/Alibaba/Aegis/PythonLoader/third_party\psutil\_common.pyt<module>s`



											

			 	9				
	
	W						

© 2026 UnknownSec