U g;@sJdZddlZddlZddlZddlZddlZddlZddlZddddddd d d d d ddddddgZej ddkZ e Z e re ZeZeZeZeZdd ZneZeZeZeZdd Ze reZneZe e dfddZe reZeZeZeZeZeZnddlZefddZee ddZee ddZee ddZee ddZee ddZee d dZe!d!krze"ej#d"Wn6ek rYn"e"k rd#Z$e%e$YnXzdd$lm&Z&Wne'k rfzdd%l(m)Z)Wn"e'k r dd%l*m)Z)YnXe+d&d'd(d)d*gZ,Gd+d,d,e-Z.e fe/e ee0e1dfe2e3e1e4fd-d.Z5dZ>Wn$e'k rDej?d;d Z>YnXdS)>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 basestringb lru_cachewhichget_terminal_sizeredirect_stderrFileNotFoundErrorPermissionErrorProcessLookupErrorInterruptedErrorChildProcessErrorFileExistsErrorcCs |dS)Nzlatin-1)encodesr>/opt/hc_python/lib64/python3.8/site-packages/psutil/_compat.pyr2scCs|SNrrrrrr;sc Csr|tkrVt|}z|j|jjd}Wn$ttfk rNd}t|YnXz |j }WnFt tfk rz |j j }Wn t k rd}t|YnXYnX|D]}|j D]}zTt|tjs t|tr|j}qz |j}Wqt k r|||}YqXqWnt tfk r*YqYnX|j|jkrqBqqqVqd}t||tk rjt||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__ TypeError func_code_builtin_super)type_Z type_or_objZ framedepthfmsgmromethrrrrJsH          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))rDZ classinfovaluerrr__subclasscheck__s ze_instance_checking_exception..wrapped..TemporaryClass.__metaclass__.__subclasscheck__N)__name__ __module__ __qualname__rHrLrrFrr __metaclass__s rP)rMrNrOr>typerP __classcell__rrCrG)r&rrCs rC)rM__doc__rFbase_exceptionrSrwrappedsz-_instance_checking_exception..wrappedr)rVrWrrUr_instance_checking_exceptions rXcCst|dttjkSNerrno)r=rrZENOENTrErrrr scCst|dttjkSrY)r=rrZZESRCHr\rrrrscCst|dttjtjhkSrY)r=rrZEACCESEPERMr\rrrrscCst|dttjkSrY)r=rrZZEINTRr\rrrrscCst|dttjkSrY)r=rrZZECHILDr\rrrrscCst|dttjkSrY)r=rrZEEXISTr\rrrrsCPythonpermzbbroken or incompatible Python implementation, see: https://github.com/giampaolo/psutil/issues/1659)r )RLock CacheInfohitsmissesmaxsizecurrsizec@s$eZdZdZefddZddZdS) _HashedSeq hashvaluecCs||dd<|||_dSrri)r?tuphashrrrr>s z_HashedSeq.__init__cCs|jSrri)r?rrr__hash__sz_HashedSeq.__hash__N)rMrNrO __slots__rlr>rmrrrrrhs rhc s|} |r.||} | |7} | D] } | | 7} q |rl| |fdd|D7} |r| |fdd| D7} n$|| dkr| d|kr| dSt| S)Nc3s|]}|VqdSrr).0vrQrr sz_make_key..c3s|]\}}|VqdSrr)rokrprqrrrrsrr)itemsrh) r@kwdstypedkwd_mark fasttypessortedtuplerQr9key sorted_itemsitemrrqr _make_keys   r~dFcsfdd}|S)zLeast-recently-used cache decorator, see: http://docs.python.org/3/library/functools.html#functools.lru_cache. csiddg d\t jtt g ddg dd< g d\dkrl fdd}nPdkr f dd}n*  fdd}  fdd } fd d }|_||_||_t|S) Nr)rr)rrrcs||}d7<|SrIr)r@ruresult)MISSESstats user_functionrrwrappers z7lru_cache..decorating_function..wrappercsX||}|}|k r2d7<|S||}||<d7<|SrIr)r@rur{r) HITSrcache cache_getmake_keyrootrrvrrrr!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@rur{linkrZ link_prevZ link_nextrlastZoldrootZoldkey)rKEYrNEXTPREVRESULT_lenrrlockrrf nonlocal_rootrrvrrrr.sN       cs6zttWSXdS)zReport cache statistics.N)rr _CacheInfor9r)rrrrrfrrr cache_info[sz:lru_cache..decorating_function..cache_infocsPz8d}||ddg|dd<ddgdd<W5XdS)z%Clear the cache and cache statistics.rN)rrclear)r)rrrrrr cache_clearesz;lru_cache..decorating_function..cache_clear) r~getr9rb __wrapped__rr functoolsupdate_wrapper)rrrrrfrv)rrrrrrrrrrrrrrrrdecorating_function s,  *-  z&lru_cache..decorating_functionr)rfrvrrrrr si)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_checks    zwhich.._access_checkNPATHwin32rPATHEXTc3s |]}|VqdSr)lowerendswithroextcmdrrrrszwhich..csg|] }|qSrrrrrr szwhich..)rrdirnameenvironrdefpathsplitpathseprplatformcurdirinsertanysetnormcaseaddjoin) rrrrpathextfilesseenr:normdirthefilenamerrrr }s8         )r PcCs~zddl}ddl}ddl}Wntk r4|YSXz*|d|d|jd}|d|dfWStk rx|YSXdS)Nrhhr1234)fcntlstructtermios ImportErrorunpackZioctl TIOCGWINSZ Exception)fallbackrrrresrrrr s  )TimeoutExpiredc@s eZdZdS)SubprocessTimeoutExpiredN)rMrNrOrrrrrsr)r ccs$tj}z|t_|VW5|t_XdSr)rstderr) new_targetoriginalrrrr s  )rF)r)@rT collections contextlibrZrrrr*__all__ version_inforobjectrintrrxrangestrrrrrr2r rrrrrrrrXEnvironmentErrorpython_implementationOSErrorr_r5r#r r threadingrbZdummy_threading namedtuplerlistrhr frozensetrQryrzr9r~shutilr F_OKX_OKr subprocessrrr contextmanagerrrrrs  ;          r5