U xe_8@sdZddlZddlZddlZddlZddlZddlZddddddd d d d d ddddddgZejddkZ e Z e re Z eZeZeZeZdd Zdd Zn e Z eZeZeZdd Zdd Ze reZneZe e dfddZe reZeZeZeZeZeZnddlZefddZee ddZee ddZee ddZee d dZee d!dZee d"dZe!d#krze"ej#d$Wn2ek rYne"k re$d%YnXzdd&lm%Z%Wne&k rlzdd'l'm(Z(Wn"e&k rdd'l)m(Z(YnXe*d(d)d*d+d,gZ+Gd-d.d.e,Z-e fe.e ee/e0dfe1e2e0e3fd/d0Z4d9d3d Z%YnXzdd4l5m6Z6Wn,e&k rej7ej8Bdfd5d Z6YnXzdd6l5m9Z9Wn e&k rd:d8d Z9YnXdS);zModule which provides compatibility with older Python versions. This is more future-compatible rather than the opposite (prefer latest Python 3 way of doing things). NPY3longrangesuperunicode basestringub lru_cachewhichget_terminal_sizeFileNotFoundErrorPermissionErrorProcessLookupErrorInterruptedErrorChildProcessErrorFileExistsErrorcCs|SNsrrA/opt/alt/python38/lib64/python3.8/site-packages/psutil/_compat.pyr+scCs |dS)Nzlatin-1)encoderrrrr .scCs t|dS)NZunicode_escape)rrrrrr6scCs|Srrrrrrr 9sc Csb|tkrFt|}z|j|jjd}Wn ttfk rJtdYnXz |j }WnBt tfk rz |j j }Wnt k rtdYnXYnX|D]}|j D]}zPt|tjst|tr|j}qz |j}Wqt k r|||}YqXqWnt tfk rYqYnX|j|jkrq6qqqFqtd|tk rZt||St|S)zuLike Python 3 builtin super(). If called without any arguments it attempts to infer them at runtime. rz'super() used in a function with no argsz$super() used in a non-newstyle classzsuper() called outside a method) _SENTINELsys _getframef_localsf_code co_varnames IndexErrorKeyError RuntimeError__mro__AttributeError __class____dict__values isinstancetypes FunctionTypepropertyfget__func____get__ TypeErrorZ func_code_builtin_super)Ztype_Z type_or_objZ framedepthfmroZmethrrrrHsB           csfdd}|S)Ncs*Gfdddj_j_S)Ncs2eZdZfddZGfdddeZZS)zE_instance_checking_exception..wrapped..TemporaryClasscsdt|dkrNt|drN|d}t|D] }|ds*t||t||q*nt|j||dS)Nrr__)lenr)dir startswithsetattrgetattrr__init__)selfargskwargsZ unwrap_meattr)TemporaryClassr&rrr:s   zN_instance_checking_exception..wrapped..TemporaryClass.__init__cs eZdZfddZddZdS)zS_instance_checking_exception..wrapped..TemporaryClass.__metaclass__cs|Srr)clsinstinstance_checkerrr__instancecheck__sze_instance_checking_exception..wrapped..TemporaryClass.__metaclass__.__instancecheck__cSstd}t||SNr)rexc_infor))r@Z classinfovaluerrr__subclasscheck__s ze_instance_checking_exception..wrapped..TemporaryClass.__metaclass__.__subclasscheck__N)__name__ __module__ __qualname__rDrHrrBrr __metaclass__s rL)rIrJrKr:typerL __classcell__rr?rC)r&rr?s r?)rI__doc__rBbase_exceptionrOrwrappedsz-_instance_checking_exception..wrappedr)rRrSrrQr_instance_checking_exceptions rTcCst|dttjkSNerrno)r9rrVZENOENTrArrrr scCst|dttjkSrU)r9rrVZESRCHrWrrrrscCst|dttjtjfkSrU)r9rrVZEACCESZEPERMrWrrrrs cCst|dttjkSrU)r9rrVZEINTRrWrrrrscCst|dttjkSrU)r9rrVZECHILDrWrrrrscCst|dttjkSrU)r9rrVEEXISTrWrrrrsZCPythonZpermzbbroken or incompatible Python implementation, see: https://github.com/giampaolo/psutil/issues/1659)r )RLock CacheInfohitsmissesmaxsizecurrsizec@s$eZdZdZefddZddZdS) _HashedSeq hashvaluecCs||dd<|||_dSrr`)r;tuphashrrrr:s z_HashedSeq.__init__cCs|jSrra)r;rrr__hash__sz_HashedSeq.__hash__N)rIrJrK __slots__rcr:rdrrrrr_s r_c s|} |r.||} | |7} | D] } | | 7} q |rl| |fdd|D7} |r| |fdd| D7} n$|| dkr| d|kr| dSt| S)Nc3s|]}|VqdSrr).0vrMrr sz_make_key..c3s|]\}}|VqdSrr)rfkrgrhrrrisrr)itemsr_) r<kwdstypedkwd_mark fasttypessortedtuplerMr5keyZ sorted_itemsitemrrhr _make_keys  rtdFcsfdd}|S)z~Least-recently-used cache decorator, see: http://docs.python.org/3/library/functools.html#functools.lru_cache cstddg d\t jtt g ddg dd< g d\dkrn fdd}nPdkr f dd}n*  fdd}  fdd } fd d }|_||_||_t |S) Nr)rr)rrrcs||}d7<|SrEr)r<rlresult)MISSESstats user_functionrrwrapper s z7lru_cache..decorating_function..wrappercsX||}|}|k r2d7<|S||}||<d7<|SrEr)r<rlrrrw) HITSrxcache cache_getmake_keyrootryrmrzrrr{s   c sp|sr ||}n|} zv|}|dk r \}|\}}}}||<||<|}||<|<||<||< d7<|WSW5 X||} z \}|krn kr"|} || <|| <| } d<|} d|<|<| =| |<n,|}||||g}||<|<|< d7<W5 X|S)Nrr)acquirerelease) r<rlrrlinkrZ link_prevZ link_nextrwZlastZoldrootZoldkey)r|KEYrxNEXTPREVRESULT_lenr}r~lockrr] nonlocal_rootryrmrzrrr{sN       cs6zttWSXdS)zReport cache statisticsN)rr _CacheInfor5r)r|rxr}rr]ryrr cache_infoFs z:lru_cache..decorating_function..cache_infocsPz8d}||ddg|dd<ddgdd<W5XdS)z$Clear the cache and cache statisticsrN)rrclear)r)r}rrryrr cache_clearOsz;lru_cache..decorating_function..cache_clear) dictrtgetr5rY __wrapped__rr functoolsupdate_wrapper)rzr{rrr]rm)r|rrxrrrrr}r~rrrrryrzrdecorating_functions,  *-  z&lru_cache..decorating_functionr)r]rmrrrrr sc)r c s"dd}tjr&||r"SdS|dkr>tjdtj}|sFdS|tj}tj dkrtj |krt| dtj tjddtj}t fd d |Drg}q‡fd d |D}ng}t }|D]P}tj|}||kr|||D](} tj|| } || |r| SqqdS) aJGiven a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cSs&tj|o$t||o$tj| Sr)ospathexistsaccessisdir)fnmoderrr _access_checkos zwhich.._access_checkNPATHZwin32rZPATHEXTc3s |]}|VqdSr)lowerendswithrfZextcmdrrriszwhich..csg|] }|qSrrrrrr szwhich..)rrdirnameenvironrdefpathsplitpathseprplatformcurdirinsertanysetnormcaseaddjoin) rrrrZpathextfilesseenr6ZnormdirZthefilenamerrrr fs8         )r PcCs~zddl}ddl}ddl}Wntk r4|YSXz*|d|d|jd}|d|dfWStk rx|YSXdS)NrZhhrZ1234)fcntltermiosstruct ImportErrorunpackZioctlZ TIOCGWINSZ Exception)Zfallbackrrrresrrrr s  )ruF)r):rP collectionsrVrrrr*__all__ version_inforobjectrintrrZxrangestrrrrr rr1r rrrrrrrrTEnvironmentErrorZpython_implementationOSErrorrXr#r rZ threadingrYZdummy_threading namedtuplerlistr_r frozensetrMrprqr5rtZshutilr F_OKX_OKr rrrrs  8           k1