403 Forbidden


Disable Functions:
Path : /lib64/python2.7/site-packages/psutil/tests/
File Upload :
Command :
Current File : //lib64/python2.7/site-packages/psutil/tests/__init__.pyc

�
S��]c@@s�	dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl
mZddl
mZddl
mZddlZddlmZddlmZdd	lmZdd
lmZddlmZddl m!Z!dd
l"m#Z#ddl"m$Z$ddl"m%Z%ddl"m&Z&ddl"m'Z'ddl"m(Z(ddl"m)Z)ej*d�kr0ddl+Z,nddl,Z,yddl,m-Z-Wn=e.k
r�ej/��ej0d�ddl-Z-WdQXnXej*d�kr�ddl1Z1ndZ1ddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXg?Z3ej4d&�p�dYd�kZ5d\ej6kZ7er�d�ndZ8e9ej:j;d'��Z<e9ej:j;d��Z=d\ej6kZ7d_Z>d�Z?e<s
e=rdndbZ@e<s"e=r9e>d9Z>e@d9Z@ndcZAejBddkrWdeZAndfZAejCjDejCjEejF��eA�ZGeGeHejI��ZGeGdgZJeGe'dh�ZKejL�jM�d�kZNejCjOejCjDejCjPeQ�dkdk��ZRejCjDeRdl�ZSejCjOejCjPeQ��ZTeo9eZUeVejWdm�ZXeVedn�ZYeVedo�ZZeVejWdp�Z[eVejWdq�Z\eVejWdr�Z]eVeds�Z^eVejWdt�Z_eVejWdu�Z`eVejWdv�ZaeVedw�Zbyeboe9ejc��ZdWneek
r+efZdnXeVedx�ZgeVedy�ZheVejWdz�Ziesheowejj�d^kZkd{�Zlel�Zmenejod|�Zpgeqe�D]$Zrerjsd}�r�eteer�^q�Zuete
d~ev��Zwex�Zyex�Zzex�Z{ej|d��Z}ej|d���Z~d�ejfd���YZ�d��Z�e�dd���Z�e�d���Z�d��Z�e�d���Z�e�d���Z�e�d��Z�d��Z�d��Z�d�evfd���YZ�e�d�ej�d�dd�e@d�d��d���Z�e�d�e�e�fd�dd�e@d�d��efe�d���Z�e�d�e�d�dd�e@d�d��d���Z�d��Z�d��Z�ej�d���Z�dd��Z�eAdYd��Z�d�e,j�fd���YZ�e�e,_�e>d��Z�dd��Z�dd��Z�d�d��Z�ej�dYd���Z�eedd��Z�e
jd��Z�d�d��Z�d��Z�ej�d���Z�d��Z�d��Z�d��Z�d��Z�d��Z�er�	ej�eAd���Z�nej�eAd���Z�dS(�s
Test utilities.
i����(tprint_functionN(tAF_INET(tAF_INET6(tSOCK_STREAM(tAIX(tMACOS(tPOSIX(tSUNOS(tWINDOWS(t
supports_ipv6(tChildProcessError(tFileExistsError(tFileNotFoundError(tPY3(tu(tunicode(twhichii(tmocktignoreiitAPPVEYORtDEVNULLtGLOBAL_TIMEOUTtMEMORY_TOLERANCEt
NO_RETRIEStPYPYt
PYTHON_EXEtROOT_DIRtSCRIPTS_DIRtTESTFILE_PREFIXtTESTFNtTESTFN_UNICODEtTOXtTRAVIStVALID_PROC_STATUSEStHAS_CPU_AFFINITYtHAS_CPU_FREQtHAS_ENVIRONtHAS_PROC_IO_COUNTERSt
HAS_IONICEtHAS_MEMORY_MAPStHAS_PROC_CPU_NUMt
HAS_RLIMITtHAS_SENSORS_BATTERYtHAS_BATTERYtHAS_SENSORS_FANStHAS_SENSORS_TEMPERATUREStHAS_MEMORY_FULL_INFOtpyrunt
reap_childrentget_test_subprocesstcreate_zombie_proctcreate_proc_children_pairtThreadTaskunittesttskip_on_access_deniedtskip_on_not_implementedtretry_on_failuretinstall_piptinstall_test_depstchdirtsafe_rmpatht
create_exetdecode_pathtencode_pathtunique_filenamet
get_winvertget_kernel_versiont
call_untiltwait_for_pidt
wait_for_filetcheck_net_addresst
get_free_porttunix_socket_pathtbind_sockettbind_unix_socketttcp_socketpairtunix_socketpairtcreate_socketst
reload_moduletimport_module_by_pathtwarntcopyload_shared_libt
is_namedtuplett1ttruet__pypy__iii
i�ig�?s$testfntjavas
$psutil-test-s
@psutil-test-s	-internals-ƒőőtasciisus-asciis..tscriptstcpu_affinitytcpu_freqt
getloadavgtenvirontionicetmemory_mapstnet_io_counterstcpu_numtio_counterstrlimittsensors_batterytsensors_fanstsensors_temperaturestthreadscCs�d�}tr�|tj�pk|tjjtj��pk|tdtjd ��pk|tj	�j
��}|s�td��n|Stjjtj�}tr�|j
dd�}ntjj|�s�t|��|SdS(NcSsFy)tj|dgdtjdtj�Wntk
r=dSX|SdS(Ns-Vtstdouttstderr(t
subprocesst
check_calltPIPEt	ExceptiontNone(texe((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pytattempt�s#
spython%s.%sis"can't find python exe real abspaths\s\\(Rtsyst
executabletostpathtrealpathRtversion_infotpsutiltProcessRnt
ValueErrorRtreplacetexiststAssertionError(RoRn((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt_get_py_exe�s		sr+tSTATUS_tAF_UNIXcCs�tj�xtjtd��D]h}t|t�rDtt�}nt}|j|�r yt	|�Wq�t
k
r�tj�q�Xq q Wx:t
D]2}yt	|�Wq�t
k
r�tj�q�Xq�WdS(Nt.(RtcloseRrtlistdirRt
isinstanceRRt
startswithR;Rlt	tracebackt	print_exct_testfiles_created(tnametprefixRs((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pytcleanup_test_files�s



cCstdt�dS(Nt	recursive(R0tTrue(((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pytcleanup_test_procs�st
ThreadTaskcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s6A thread task which does nothing expect staying alive.cCs5tjj|�t|_d|_tj�|_dS(Ng����MbP?(t	threadingtThreadt__init__tFalset_runningt	_intervaltEventt_flag(tself((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�s		cCs&|jj}d||jt|�fS(Ns<%s running=%s at %#x>(t	__class__t__name__R�tid(R�R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt__repr__	scCs|j�|S(N(tstart(R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt	__enter__
s
cOs|j�dS(N(tstop(R�targstkwargs((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt__exit__scCs9|jrtd��ntjj|�|jj�dS(sStart thread and keep it running until an explicit
        stop() request. Polls for shutdown every 'timeout' seconds.
        salready startedN(R�RxR�R�R�R�twait(R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�s	cCs:t|_|jj�x|jr5tj|j�qWdS(N(R�R�R�tsetttimetsleepR�(R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pytruns	
cCs/|jstd��nt|_|j�dS(s8Stop thread execution and and waits until it is stopped.salready stoppedN(R�RxR�tjoin(R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�#s		(
R�t
__module__t__doc__R�R�R�R�R�R�R�(((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�s							cs"tj���fd��}|S(Ncs3y�||�SWntk
r.t��nXdS(N(RlR0(R�R�(tfun(s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pytwrapper1s

(t	functoolstwraps(R�R�((R�s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt_reap_children_on_err0scKs�|jdt�|jdt�|jdtj��|jdtj�trhd}|jd|�n|dkr�tt�dt}t	d|g}t
j||�}tj
|�ttd	td
t�n,t
j||�}tj
|�t|j�|S(s{Creates a python subprocess which does nothing for 60 secs and
    return it as subprocess.Popen instance.
    If "cmd" is specified that is used instead of python.
    By default stdin and stdout are redirected to /dev/null.
    It also attemps to make sure the process is in a reasonably
    initialized state.
    The process is registered for cleanup on reap_children().
    tstdinRgtcwdtenvit
creationflagss:from time import sleep;open(r'%s', 'w').close();sleep(60);s-ctdeletetemptyN(t
setdefaultRRrtgetcwdR\RRmR;t_TESTFNRRitPopent_subprocesses_startedtaddRDR�RCtpid(tcmdtkwdstCREATE_NO_WINDOWtpylinetsproc((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR1;s&




cCs�tjjt�d}tjd|tf�}trJt|dd�}nt|�}t	j
|j�}t|dt
dt
�}t|�t|�}tj|�t	j
|�}||fS(sCreate a subprocess which creates another one as in:
    A (us) -> B (child) -> C (grandchild).
    Return a (child, grandchild) tuple.
    The 2 processes are fully initialized and will live for 60 secs
    and are registered for cleanup on reap_children().
    t2s        import subprocess, os, sys, time
        s = "import os, time;"
        s += "f = open('%s', 'w');"
        s += "f.write(str(os.getpid()));"
        s += "f.close();"
        s += "time.sleep(60);"
        p = subprocess.Popen(['%s', '-c', s])
        p.wait()
        R�iR�R�(RrRstbasenameR�ttextwraptdedentRRR/RvRwR�RDR�R;tintt
_pids_startedR�(t_TESTFN2tstsubptchild1tdatat
child2_pidtchild2((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR3_s	

c	s'tjst�tr'tjdt�nt}tj	d|�}t
jtjtj
����}|jt�|j|�|jd�t|�|j�\}}zntj|j�gggt�t|jd��}tj|�tj|��t�fd�d�|SWd|j�XWdQXdS(s+Create a zombie process and return its PID.R�s        import os, sys, time, socket, contextlib
        child_pid = os.fork()
        if child_pid > 0:
            time.sleep(3000)
        else:
            # this is the zombie process
            s = socket.socket(socket.AF_UNIX)
            with contextlib.closing(s):
                s.connect('%s')
                if sys.version_info < (3, ):
                    pid = str(os.getpid())
                else:
                    pid = bytes(str(os.getpid()), 'ascii')
                s.sendall(pid)
        iics
�j�S(N(tstatus((tzproc(s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt<lambda>�ssret == psutil.STATUS_ZOMBIEN(RvRR{RttempfiletmktempRRR�R�t
contextlibtclosingtsocketR~t
settimeoutRtbindtlistenR/taccepttselecttfilenoR�trecvR�R�RwRBR�(t	unix_filetsrctsocktconnt_tzpid((R�s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR2�s$





cKs�|jdd�|jdd�tjdtdddt��S}tj|j�|j	|�|j
�tt|jg|�}t
|j�WdQX|S(seRun python 'src' code string in a separate interpreter.
    Returns a subprocess.Popen instance.
    RgRhR�tmodetwtR�N(R�RmR�tNamedTemporaryFileRR�R�R�R�twritetflushR1RRCR�(R�R�tfR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR/�s	

cKst|ttf�rtnt}tr3|r3dnd}|jd|�|jdtj�|jdtj�|jdt�|jd|�tj	||�}t
j|�|j�\}}|j
dkr�t|��n|r�t|�n|jd�r
|d	 }n|S(
sUrun cmd in a subprocess and return its output.
    raises RuntimeError on error.
    iitshellRgRhtuniversal_newlinesR�s
i����(R�tstrRR�R�RR�RiRkR�R�R�tcommunicatet
returncodetRuntimeErrorROtendswith(R�R�R�tflagstpRgRh((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pytsh�s"!


c		Cs�d�}|r0ttj�jdt��}n	t�}x�tr*tj�}tj|j	�y|j
�WnCtk
r�}tr�|j
dkr�q�|jtjkr��q�nX|jr�|jj�n|jr�|jj�nz|jr|jj�nWdy|j�Wntk
r%nXXq<WxWtr�tj�}ytj|�}Wntjk
rs||�q.X|j|�q.W|r�x3|D]+}y|j
�Wq�tjk
r�q�Xq�Wtj|dt�\}}xA|D]9}td|�y|j�Wq�tjk
rq�Xq�Wtj|dt�\}}|rcx|D]}td|�qHWnx|D]}||j	�qjWndS(s#Terminate and wait() any subprocess started by this test suite
    and ensure that no zombies stick around to hog resources and
    create problems  when looking for refleaks.

    If resursive is True it also tries to terminate and wait()
    all grandchildren started by this process.
    cSs�tj|�st|��|tj�ks:t|��y,tj|�}|j�set|��Wntjk
r|nXds�td|��dS(Nispid %s is not gone(Rvt
pid_existsR{tpidsRwt
is_runningt
NoSuchProcess(R�R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pytassert_gone�sR�iNttimeouts0couldn't terminate process %r; attempting kill()sprocess %r survived kill()(R�RvRwtchildrenR�R�tpopR�R�R�t	terminatetOSErrorRtwinerrorterrnotESRCHRgR�RhR�R�R
R�t
wait_procsRROtkill(	R�R�R�R�terrR�R�tgonetalive((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR0�sf	!		
			
		



cCs�tstd��nd}tj�d}x4|D],}|j�sP|dkr]||7}q2Pq2W|s{td|��nd}d}|jd�}t|d�}t|�dkr�t|d�}nt|�dkr�t|d�}n|||fS(	s"Return a tuple such as (2, 6, 36).s	not POSIXRRiRscan't parse %riii(	RtNotImplementedErrorRrtunametisdigitRxtsplitR�tlen(R�Rtctminortmicrotnumstmajor((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRA1s&

cCs�tstd��ntj�}t|d�rB|jp<d}n:tjd|d�}|rvt|j	d��}nd}|d|d|fS(Nsnot WINDOWStservice_pack_majoris\s\d$ii(
RRRptgetwindowsversionthasattrRtretsearchR�tgroup(twvtsptr((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR@IstretrycBsAeZdZeddddd�Zd�Zd�Zd�ZRS(sA retry decorator.g����MbP?cCsL|r|rtd��n||_||_||_||_||_dS(Ns/timeout and retries args are mutually exclusive(Rxt	exceptionR�tretriestintervaltlogfun(R�RR�RRR((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�`s				ccs~|jr=tj�|j}x[tj�|kr9dVqWn=|jrhx1t|j�D]}dVqVWnxtrydVqkWdS(N(R�R�RtrangeR�(R�tstop_atR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt__iter__os			cCs&|jdk	r"tj|j�ndS(N(RRmR�R�(R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�{scs.tj����fd��}�|_|S(Ncs�d}xj�D]b}y�||�SWq
�jk
rn}|}�jdk	r^�j|�n�j�q
q
Xq
Wtr�|�n�dS(N(RmRRR�R
(R�R�texcR�(R�R�(s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR��s

	(R�R�t	decorator(R�R�R�((R�R�s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt__call__s!	N(	R�R�R�RlRmR�RR�R!(((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR]s
		RRR�Rg����MbP?cCs'tj|�tr#tjd�ndS(s�Wait for pid to show up in the process list then return.
    Used in the test suite to give time the sub process to initialize.
    g{�G�z�?N(RvRwRR�R�(R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRC�s
cCsPt|d��}|j�}WdQX|s9|s9t�n|rLt|�n|S(s8Wait for a file to be written on disk with some content.trbN(topentreadR{R;(tfnameR�R�R�R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRD�s
cCs|�}t|�st�|S(sVKeep calling function for timeout secs and exit if eval()
    expression is True.
    (tevalR{(R�texprtret((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRB�s	cCs�d�}yltj|�}tj|j�rEtjtj|�}ntjtj|�}t	rj|�n
||�Wnt
k
r�nXdS(s>Convenience function for removing temporary test files or dirscSs�tj�d}xntj�|kr�y|�SWn=tk
rCn-tk
ro}|}tdt|��nXtjd�qW|�dS(Nisignoring %sg{�G�z�?(R�RtWindowsErrorROR�R�(R�RR�R((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt	retry_fun�s
N(RrtstattS_ISDIRtst_modeR�tpartialtshutiltrmtreetremoveRR(RsR*tstR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR;�s	

cCs)ytj|�Wntk
r$nXdS(s-Convenience function for creating a directoryN(RrtmkdirR(tdir((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt
safe_mkdir�s
ccs7tj�}ztj|�dVWdtj|�XdS(s@Context manager which temporarily changes the current directory.N(RrR�R:(tdirnametcurdir((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR:�s

	cCs*tjj|�st|��|r�td�s@td��nt|t�ratj	d�}nt|t
�s|t|��tjdddt
dd��}|j|�Wd	QXz tjd|jd
|g�Wd	t|j�XnBtjt|�tr&tj|�}tj||jtjB�nd	S(s1Creates an executable file in the given location.tgccsgcc is not installeds�
                #include <unistd.h>
                int main() {
                    pause();
                    return 1;
                }
                tsuffixs.cR�R�R�Ns-o(RrRsRzR{RRxR�tboolR�R�R�R�R�R�R�RiRjR�R;R/tcopyfileRRR+tchmodR-tS_IEXEC(toutpathtc_codeR�R2((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR<�s$	 cCstjd|d|�S(NR�R9(R�R�(R�R9((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR?stTestCasecBs2eZd�Zeejd�s0ejjZnRS(cCsB|jj}|jd�s(d|}nd||jj|jfS(Nspsutil.s
psutil.tests.s%s.%s.%s(R�R�R�R�t_testMethodName(R�tfqmod((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt__str__ s

tassertRaisesRegex(R�R�RCRtunittestR@tassertRaisesRegexpRD(((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR@s		c	Cs(d�}tdtddd|d|�S(sZDecorator which runs a test function and retries N times before
    actually failing.
    cSstd|dtj�dS(Ns%r, retryingtfile(tprintRpRh(R((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR5sRR�RRN(RR{Rm(RR((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR71s	cs�fd�}|S(s,Decorator to Ignore AccessDenied exceptions.cs%tj����fd��}|S(NcsVy�||�SWn>tjk
rQ�dk	r?�s?�q?ntjd��nXdS(Nsraises AccessDenied(RvtAccessDeniedRmREtSkipTest(R�R�(R�tonly_if(s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�?s	(R�R�(R�R�(RK(R�s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR >s!	((RKR ((RKs;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR5<scs�fd�}|S(s3Decorator to Ignore NotImplementedError exceptions.cs%tj����fd��}|S(Ncs`y�||�SWnHtk
r[�dk	r<�s<�q<nd�j}tj|��nXdS(Ns4%r was skipped because it raised NotImplementedError(RRmR�RERJ(R�R�tmsg(R�RK(s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR�Os
	
(R�R�(R�R�(RK(R�s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR Ns!((RKR ((RKs;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyR6Ls
s	127.0.0.1cCsCtjtj���(}|j|df�|j�dSWdQXdS(sReturn an unused TCP port.iiN(R�R�R�R�tgetsockname(thostR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRFcsccsTtjst�td|�}z	|VWdytj|�Wntk
rNnXXdS(saA context manager which returns a non-existent file name
    and tries to delete it on exit.
    R9N(RvRR{R?RrtunlinkR�(R9Rs((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRGjs	
cCs�|dkr'|ttfkr'd}ntj||�}y_tjd	krg|jtjtjd�n|j	|�|tj
kr�|jd�n|SWntk
r�|j
��nXdS(
sBinds a generic socket.RRitnttcygwiniiN(RRi(sntscygwin(RmRRR�RrR�t
setsockoptt
SOL_SOCKETtSO_REUSEADDRR�RR�RlR�(tfamilyttypetaddrR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRHzs	


cCs�tjst�tjj|�s.t|��tjtj|�}y0|j|�|tj	krr|j
d�nWntk
r�|j��nX|S(sBind a UNIX socket.i(
RvRR{RrRsRzR�R~R�RR�RlR�(R�RVR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRI�s


c	Cs�tjtj|t����}|j|�|jd�|j�}tj|t�}y\|j|�|j�}x<tr�|j	�\}}||kr�||fS|j
�quWWntk
r�|j
��nXWdQXdS(s^Build a pair of TCP sockets connected to each other.
    Return a (server, client) tuple.
    iN(R�R�R�RR�R�RMtconnectR�R�R�R�(RURWtllR	tcaddrta((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRJ�s 


	


cCs�tjst�d}}yXt|dtj�}|jd�tjtjtj�}|jd�|j	|�WnFt
k
r�|dk	r�|j�n|dk	r�|j�n�nX||fS(s�Build a pair of UNIX sockets connected to each other through
    the same UNIX file name.
    Return a (server, client) tuple.
    RViN(RvRR{RmRIR�RtsetblockingR~RXRlR�(R�tservertclient((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRK�s





ccseg}d}}z|jttjtj��|jttjtj��t�r�|jttjtj��|jttjtj��nt	r
t
r
t�j�}t�j�}t
|�\}}t|dtj�}x'|||fD]}|j|�q�Wn|VWdx|D]}|j�qW|dk	rGt|�n|dk	r`t|�nXdS(s1Open as many socket families / types as possible.RVN(RmtappendRHR�RRt
SOCK_DGRAMR	RRtHAS_CONNECTIONS_UNIXRGR�RKRIR�R;(tsockstfname1tfname2ts1ts2ts3R�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRL�s,
		

cCs�ddl}tr9tr9t|tj�s9t|��n|tjkr�g|jd�D]}t	|�^qX}t
|�dks�t|��x6|D].}d|ko�dkns�t|��q�Wts�t|�}n|j|�n�|tj
kr;t|t�st|��ts+t|�}n|j|�nE|tjkrqtjd|�dk	s�t|��ntd|��dS(	s[Check a net address validity. Supported families are IPv4,
    IPv6 and MAC addresses.
    i����NRiii�s([a-fA-F0-9]{2}[:|\-]?){6}sunknown family %r(t	ipaddresstenumR
R�tIntEnumR{R�RRR�RRtIPv4AddressRR�tIPv6AddressRvtAF_LINKRtmatchRmRx(RWRURhtxtoctstnum((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRE�s&!(
,'cCscy(ddl}t|d�s't�nWn'tk
rQddl}|j|�SX|j|�SdS(s,Backport of importlib.reload of Python 3.3+.i����Ntreload(t	importlibRtImportErrortimpRr(tmoduleRsRu((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRMs

cCs�tjjtjj|��d}tjddkrQddl}|j||�Stjd dkr�ddlm	}|||�j
�Sddl}|jj
||�}|jj|�}|jj|�|SdS(Niii����ii(tSourceFileLoader(ii(RrRstsplitextR�RpRuRutload_sourcetimportlib.machineryRwtload_moduletimportlib.utiltutiltspec_from_file_locationtmodule_from_spectloadertexec_module(RsR�RuRwRstspectmod((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRNs"cCstj|t�dS(sRaise a warning msg.N(twarningsROtUserWarning(RL((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRO'scCstt|�}|j}t|�dks7|dtkr;tSt|dd�}t|t�s`tStd�|D��S(s-Check if object is an instance of namedtuple.iit_fieldscss!|]}t|�tkVqdS(N(RVR�(t.0tn((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pys	<genexpr>5sN(	RVt	__bases__RttupleR�tgetattrRmR�tall(RotttbR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRQ,s	"ccs�trdnd}d}tjd|d|�}gtj�j�D]C}tjj|j�d|krC||jj	�krC|j^qC}t
j|�}tj
||�ztj|�|VWdt|�XdS(s�Ctx manager which picks up a random shared CO lib used
        by this process, copies it in another location and loads it
        in memory via ctypes. Return the new absolutized path.
        tpypytpythons.soR�R9iN(RR�R�RvRwR^RrRsRxtlowertrandomtchoiceR/R;tctypestCDLLR;(t
dst_prefixRntexttdstRotlibsR�((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRP9s$
	ccsbddlm}ddlm}d}tjd|d|�}gtj�j�D]j}tj	j
|j	�dj�|krQdtj	j|j	�j�krQd	|j	j�krQ|j	^qQ}t
j|�}tj||�d
}ztj|�}|VWd
|d
k	rStjjj}	|jg|	_|	|j�}
|
dkrS|�qSnt|�Xd
S(s�Ctx manager which picks up a random shared DLL lib used
        by this process, copies it in another location and loads it
        in memory via ctypes.
        Return the new absolutized, normcased path.
        i����(twintypes(tWinErrors.dllR�R9iR�twow64Ni(R�R�R�R�R�RvRwR^RrRsRxR�R�R�R�R/R;RmtWinDLLtwindlltkernel32tFreeLibrarytHMODULEtargtypest_handleR;(R�R�R�R�R�RoR�R�tcfileR�R(((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyRPMs*%!$	
(ii(ii(RSRT(iiii�(sasciisus-ascii(RRi(�R�t
__future__RtatexitR�R�R�R�RrR�RR�R/R�R+RiRpR�R�R�R�R�R�RRRRvRRRRRtpsutil._commonR	tpsutil._compatR
RRR
RRRRut	unittest2RERRttcatch_warningstsimplefilterRiRmt__all__tgetenvRtbuiltin_module_namesRt	WIN_VISTAR:R\tgetR RRRRRR�RsR�RtR�RR�tgetpidR�RtgetfilesystemencodingR�tASCII_FStabspathR6t__file__RRtHERERaRRwR"R#tHAS_GETLOADAVGR$R&R'tHAS_NET_IO_COUNTERSR(R%R)R*RcR+RlR�R,R-tHAS_THREADStgetuidtSKIP_SYSCONSR|RR#tdevnullRR4RoR�R�R!tobjectR~R�R�R�R�tregisterR�R�R�R�R�R1R3R2R/R�R�R0RAR@RR�RCtEnvironmentErrorR{RDRBR;R5tcontextmanagerR:R<R?R@R7R5R6RFRGRHRIRJRKRLRERMRNRORQRP(((s;/usr/lib64/python2.7/site-packages/psutil/tests/__init__.pyt<module>	s\


			


	'
0


		$			
0	##	%`		:	!						
			

404 Not Found
[ LogOut ]