B 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#krye"ej#d$Wn2ek rYne"k re$d%YnXydd&lm%Z%Wne&k rlydd'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%YnXydd4l5m6Z6Wn,e&k rej7ej8Bdfd5d Z6YnXydd6l5m9Z9Wn 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|S)N)srrA/opt/alt/python37/lib64/python3.7/site-packages/psutil/_compat.pyr+scCs |dS)Nzlatin-1)encode)rrrrr .scCs t|dS)NZunicode_escape)r)rrrrr6scCs|S)Nr)rrrrr 9sc Csh|tkrLt|}y|j|jjd}Wn ttfk rJtdYnXy |j }WnBt tfk ry |j j }Wnt k rtdYnXYnXx|D]}x|j D]}yXxRt|tjst|tr|j}qy |j}Wqt k r|||}YqXqWWnt tfk r(wYnX|j|jkrPqWqPqWtd|tk r`t||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..TemporaryClasscsht|dkrRt|drR|d}x@t|D] }|ds,t||t||q,Wnt|j||dS)Nrr__)lenr'dir startswithsetattrgetattrr__init__)selfargskwargsZ unwrap_meattr)TemporaryClassr$rrr8s  zN_instance_checking_exception..wrapped..TemporaryClass.__init__cs eZdZfddZddZdS)zS_instance_checking_exception..wrapped..TemporaryClass.__metaclass__cs|S)Nr)clsinst)instance_checkerrr__instancecheck__sze_instance_checking_exception..wrapped..TemporaryClass.__metaclass__.__instancecheck__cSstd}t||S)Nr)rexc_infor')r>Z classinfovaluerrr__subclasscheck__s ze_instance_checking_exception..wrapped..TemporaryClass.__metaclass__.__subclasscheck__N)__name__ __module__ __qualname__rArDr)r@rr __metaclass__s rH)rErFrGr8typerH __classcell__r)r=r@)r$rr=s r=)rE__doc__)r@)base_exception)r=r@rwrappedsz-_instance_checking_exception..wrappedr)rLrMr)rLr_instance_checking_exceptions rNcCst|dttjkS)Nerrno)r7rrOZENOENT)r?rrrr scCst|dttjkS)NrO)r7rrOZESRCH)r?rrrrscCst|dttjtjfkS)NrO)r7rrOZEACCESZEPERM)r?rrrrs cCst|dttjkS)NrO)r7rrOZEINTR)r?rrrrscCst|dttjkS)NrO)r7rrOZECHILD)r?rrrrscCst|dttjkS)NrO)r7rrOEEXIST)r?rrrrsZCPythonZpermzbbroken or incompatible Python implementation, see: https://github.com/giampaolo/psutil/issues/1659)r )RLock CacheInfohitsmissesmaxsizecurrsizec@s$eZdZdZefddZddZdS) _HashedSeq hashvaluecCs||dd<|||_dS)N)rX)r9tuphashrrrr8s z_HashedSeq.__init__cCs|jS)N)rX)r9rrr__hash__sz_HashedSeq.__hash__N)rErFrG __slots__rZr8r[rrrrrWs rWc s|} |r2||} | |7} x| D] } | | 7} q"W|rp| |fdd|D7} |r| |fdd| D7} n$|| dkr| d|kr| dSt| S)Nc3s|]}|VqdS)Nr).0v)rIrr sz_make_key..c3s|]\}}|VqdS)Nr)r]kr^)rIrrr_srr)itemsrW) r:kwdstypedkwd_mark fasttypessortedtuplerIr3keyZ sorted_itemsitemr)rIr _make_keys   rjdFcsfdd}|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<|S)Nrr)r:rbresult)MISSESstats user_functionrrwrapper s z7lru_cache..decorating_function..wrappercsX||}|}|k r2d7<|S||}||<d7<|S)Nrr)r:rbrhrm) HITSrncache cache_getmake_keyrootrorcrprrrqs   c sl|sr ||}n|} zr|}|dk r \}|\}}}}||<||<|}||<|<||<||< d7<|SWd X||} z \}|krn kr|} || <|| <| } d<|} d|<|<| =| |<n,|}||||g}||<|<|< d7<Wd X|S)Nrr)acquirerelease) r:rbrhlinkrvZ link_prevZ link_nextrmZlastZoldrootZoldkey)rrKEYrnNEXTPREVRESULT_lenrsrtlockrurU nonlocal_rootrorcrprrrqsN      cs2zttSXdS)zReport cache statisticsN)rw _CacheInfor3rxr)rrrnrsrrUrorr cache_infoFs  z:lru_cache..decorating_function..cache_infocsPz8d}||ddg|dd<ddgdd<WdXdS)z$Clear the cache and cache statisticsrN)rwclearrx)rv)rsrrrorr cache_clearOsz;lru_cache..decorating_function..cache_clear) dictrjgetr3rQ __wrapped__rr functoolsupdate_wrapper)rprqrr)rUrc)rrrzrnr{r|r}r~rsrtrrurrvrorprdecorating_functions,  *-  z&lru_cache..decorating_functionr)rUrcrr)rUrcrr 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 }xT|D]L}tj|}||kr||x(|D] } tj|| } || |r| SqWqWdS) 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| S)N)ospathexistsaccessisdir)fnmoderrr _access_checkoszwhich.._access_checkNPATHZwin32rZPATHEXTc3s |]}|VqdS)N)lowerendswith)r]ext)cmdrrr_szwhich..csg|] }|qSrr)r]r)rrr szwhich..)rrdirnameenvironrdefpathsplitpathseprplatformcurdirinsertanysetnormcaseaddjoin) rrrrZpathextfilesseenr4ZnormdirZthefilenamer)rrr fs8            )r PcCstyddl}ddl}ddl}Wntk r0|SXy(|d|d|jd}|d|dfStk rn|SXdS)NrZhhrZ1234)fcntltermiosstruct ImportErrorunpackZioctlZ TIOCGWINSZ Exception)ZfallbackrrrZresrrrr s )rkF)r):rK collectionsrOrrrr(__all__ version_inforobjectrintrrZxrangestrrrrr rr/r rrrrrrrrNEnvironmentErrorZpython_implementationOSErrorrPr!r rZ threadingrQZdummy_threading namedtuplerlistrWr frozensetrIrfrgr3rjZshutilr F_OKX_OKr rrrrs    8   k1