Your IP : 3.145.108.87


Current Path : /lib64/python3.6/site-packages/psutil/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/psutil/__pycache__/_compat.cpython-36.pyc

3

��JZ��!@s�dZddlZddlZddlZddlZddddddd	d
ddg
Zejdd
kZerpeZ	e
ZeZ
eZdd�Zdd	�Zn e	Z	eZe
Z
eZdd�Zdd	�ZyeZWnek
r�dd
�ZYnXyddlmZWn�ek
�rhyddlmZWn"ek
�r
ddlmZYnXejdddddg�ZGdd�de�Ze�feeeeed�f�e e!ee"fdd�Z#d#d d�ZYnXydd!l$m%Z%Wn,ek
�r�ej&ej'Bdfd"d�Z%YnXdS)$z?Module which provides compatibility with older Python versions.�N�PY3�long�xrange�unicode�
basestring�u�b�callable�	lru_cache�which�cCs|S)N�)�sr
r
�/usr/lib64/python3.6/_compat.pyrscCs
|jd�S)Nzlatin-1)�encode)rr
r
rrscCs
t|d�S)NZunicode_escape)r)rr
r
rr"scCs|S)Nr
)rr
r
rr%scCstdd�t|�jD��S)Ncss|]}d|jkVqdS)�__call__N)�__dict__)�.0�klassr
r
r�	<genexpr>.szcallable.<locals>.<genexpr>)�any�type�__mro__)�objr
r
rr	-s)r
)�RLock�	CacheInfo�hits�misses�maxsize�currsizec@s$eZdZdZefdd�Zdd�ZdS)�
_HashedSeq�	hashvaluecCs||dd�<||�|_dS)N)r!)�self�tup�hashr
r
r�__init__Esz_HashedSeq.__init__cCs|jS)N)r!)r"r
r
r�__hash__Isz_HashedSeq.__hash__N)�__name__�
__module__�__qualname__�	__slots__r$r%r&r
r
r
rr Bsr c	s�|}	|r2||j��}
|	|7}	x|
D]}|	|7}	q"W|rp|	|�fdd�|D��7}	|r�|	|�fdd�|
D��7}	n$||	�dkr��|	d�|kr�|	dSt|	�S)Nc3s|]}�|�VqdS)Nr
)r�v)rr
rrWsz_make_key.<locals>.<genexpr>c3s|]\}}�|�VqdS)Nr
)r�kr+)rr
rrYs�r)�itemsr )�args�kwds�typed�kwd_mark�	fasttypes�sorted�tupler�len�keyZsorted_items�itemr
)rr�	_make_keyLs
r9�dFcs��fdd�}|S)z~Least-recently-used cache decorator, see:
        http://docs.python.org/3/library/functools.html#functools.lru_cache
        cst��ddg�
d
\��t�
�j�t�t��	g���ddg�dd�<�g�d\�����dkrn��
�fdd�}nP�dkr������
��
��f	dd�}n*����������	�
���
��fdd�}����	��
fd	d
�}��	��
fdd�}�|_||_||_tj	|��S)Nrr-�rcs�||�}��d7<|S)Nr-r
)r/r0�result)�MISSES�stats�
user_functionr
r�wrapperos
z7lru_cache.<locals>.decorating_function.<locals>.wrappercsX�||��}�|��}|�k	r2��d7<|S�||�}|�|<��d7<|S)Nr-r
)r/r0r7r<)	�HITSr=�cache�	cache_get�make_key�rootr>r1r?r
rr@ts

csl|s�r�
||��}n|}�	j�zr�|�}|dk	r��\}|\}}}}||�<||�<|�}||�<|�<||�<||�<�
�d7<|SWd�	j�X�||�}�	j�z��\}|�kr�n�����k�r|}	||	�<||	�<|	�}�d<|�}
d|�<|�<�|
=|	�|<n,|�}||||g}||�<|�<�|<�
�d7<Wd�	j�X|S)Nr-r)�acquire�release)r/r0r7�linkrEZ	link_prevZ	link_nextr<ZlastZoldrootZoldkey)rA�KEYr=�NEXT�PREV�RESULT�_lenrBrC�lockrDr�
nonlocal_rootr>r1r?r
rr@sN



cs2�j�zt�����t���S�j�XdS)zReport cache statisticsN)rF�
_CacheInfor6rGr
)rAr=rBrNrr>r
r�
cache_info�s

z:lru_cache.<locals>.decorating_function.<locals>.cache_infoc
sP�j�z8�j��d}||ddg|dd�<ddg�dd�<Wd�j�XdS)z$Clear the cache and cache statisticsrN)rF�clearrG)rE)rBrNrOr>r
r�cache_clear�sz;lru_cache.<locals>.decorating_function.<locals>.cache_clear)rr-)rr-r;r)
�dictr9�getr6r�__wrapped__rQrS�	functools�update_wrapper)r?r@rQrS)rr1)rArIr=rJrKrLrMrBrCrNrDrOrEr>r?r�decorating_functionbs,*-	z&lru_cache.<locals>.decorating_functionr
)rr1rYr
)rr1rr
^sc)rcs"dd�}tjj��r&|�|�r"�SdS|dkr>tjjdtj�}|sFdS|jtj�}tj	dkr�tj
|krt|jdtj
�tjjdd�jtj�}t�fd	d
�|D��r��g}q‡fdd�|D�}n�g}t
�}xT|D]L}tjj|�}||kr�|j|�x(|D] }	tjj||	�}
||
|�r�|
Sq�Wq�WdS)
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&tjj|�o$tj||�o$tjj|�S)N)�os�path�exists�access�isdir)�fn�moder
r
r�
_access_check�szwhich.<locals>._access_checkN�PATHZwin32rZPATHEXT�c3s |]}�j�j|j��VqdS)N)�lower�endswith)r�ext)�cmdr
rr�szwhich.<locals>.<genexpr>csg|]}�|�qSr
r
)rrf)rgr
r�
<listcomp>�szwhich.<locals>.<listcomp>)rZr[�dirname�environrU�defpath�split�pathsep�sys�platform�curdir�insertr�set�normcase�add�join)rgr`r[raZpathext�files�seen�dirZnormdirZthefile�namer
)rgrr�s8	






)r:F)(�__doc__�collectionsrWrZrn�__all__�version_infor�intr�ranger�strrrrrr	�	NameErrorr
�ImportErrorZ	threadingrZdummy_threading�
namedtuplerP�listr �objectrr�	frozensetrr4r5r6r9Zshutilr�F_OK�X_OKr
r
r
r�<module>sT


k

?>