%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/support/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/support/__init__.pyc


Oac=@s
dZedkr!ednddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZyddlZWnek
r:dZnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d4d<d=d>d?d@g=ZdefdAYZdefdBYZdefdCYZdejfdDYZej e!dEZ"e#dFZ$dGZ%dHZ&dde#dIZ'dJZ(dKZ)dZ*dLa+dLa,e#Z-da.dMZ/dNZ0dOZ1dPZ2e
jj3dQr%e#dRZ4dSZ5dTZ6dUZ7nej8Z5ej9Z6dVZ7dWZ8dXZ9dYZ:dZZ;d[Z<d\Z=dd]Z>d^Z?d_Z@d`ZAejBejCdaZDe@dbZEdcZFeFZGddZHdeZIdfZJdZKdZLe
jj3djZMyeNe!ZOWnePk
r'e#ZOnXejQeOdkZRdlZSdZTeOrxeUdmeUdneUdoeUdpeUdqeUdreUdseUdteUdueUdveUdwfD]XZVy7eVjWe
jXjYe
jXeVkreZnWneZk
r	qXeVZTPqWnej[djkr0dxZ\nej[dykrHdzZ\nd{Z\eOre]d|eNrld}Z^neNd}d~Z^e
jXZ_e`e
dse
jaddkrdZbqecdZbyebjWdWnedk
rqXdebGHndjee\ejfZ\dZgejhZiej de#dZjej e#dZkej de#dZlejmjnejmjoepZqejmjneqZrejmjserdZtddZudZvdZwd|dddZxddZydezfdYZ{e#dZ|ej dZ}ej dZ~d&ezfdYZd'ejfdYZdezfdYZd*ezfdYZej dddZej dZdZdZdZdZdZe`e
drdeZnedZdZdZdZdZdZdZdZdZdheZdeZdgeZe
jZdZdedZdee!dZdZd0ddYZdZdZdZddZdZdZdZdZdadadZdZdZdZede#pQ	e
jdkpQ	ejdZejQedZddZe#ZdZdZdZej ddZdZej ddZej dZej dZdZeje`e
ddZdZdZddZej dZdZd@ddYZdZdZdddYZdS(s7Supporting definitions for the Python regression tests.stest.supports3test.support must be imported from the test packageiNtErrort
TestFailedt
TestDidNotRuntResourceDeniedt
import_moduletverboset
use_resourcest
max_memusetrecord_original_stdouttget_original_stdouttunloadtunlinktrmtreetforgettis_resource_enabledtrequirestrequires_mac_vertfind_unused_portt	bind_porttfcmpthave_unicodet	is_jythontTESTFNtHOSTtFUZZtSAVEDCWDttemp_cwdtfindfiletsortdicttcheck_syntax_errortopen_urlresourcetcheck_warningstcheck_py3k_warningstCleanImporttEnvironmentVarGuardtcaptured_outputtcaptured_stdouttTransientResourcettransient_internettrun_with_localetset_memlimitt
bigmemtesttbigaddrspacetesttBasicTestRunnertrun_unittesttrun_doctesttthreading_setuptthreading_cleanuptreap_threadst
start_threadstcpython_onlytcheck_impl_detailt
get_attributet
py3k_bytestimport_fresh_modulet
reap_childrentstrip_python_stderrtIPV6_ENABLEDtrun_with_tztSuppressCrashReportcBseZdZRS(s*Base class for regression test exceptions.(t__name__t
__module__t__doc__(((s1/usr/local/lib/python2.7/test/support/__init__.pyR2scBseZdZRS(sTest failed.(R<R=R>(((s1/usr/local/lib/python2.7/test/support/__init__.pyR5scBseZdZRS(sTest did not run any subtests.(R<R=R>(((s1/usr/local/lib/python2.7/test/support/__init__.pyR8scBseZdZRS(sTest skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not been enabled.  It is used to distinguish between expected
    and unexpected skips.
    (R<R=R>(((s1/usr/local/lib/python2.7/test/support/__init__.pyR;sccs=|r4tjtjddtdVWdQXndVdS(sContext manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.tignores.+ (module|package)N(twarningstcatch_warningstfilterwarningstDeprecationWarning(R?((s1/usr/local/lib/python2.7/test/support/__init__.pyt_ignore_deprecated_importsCs
c	CsSt|Aytj|SWn(tk
rH}tjt|nXWdQXdS(sImport and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(RDt	importlibRtImportErrortunittesttSkipTesttstr(tnamet
deprecatedtmsg((s1/usr/local/lib/python2.7/test/support/__init__.pyRRs

cCs|tjkr&t|tj|=nxTttjD]C}||ks[|j|dr6tj|||<tj|=q6q6WdS(swHelper function to save and remove a module from sys.modules

       Raise ImportError if the module can't be imported.t.N(tsystmodulest
__import__tlistt
startswith(RJtorig_modulestmodname((s1/usr/local/lib/python2.7/test/support/__init__.pyt_save_and_remove_module_s

cCsFt}ytj|||<Wntk
r4t}nXdtj|<|S(sHelper function to save and block a module in sys.modules

       Return True if the module was in sys.modules, False otherwise.N(tTrueRNROtKeyErrortFalsetNone(RJRStsaved((s1/usr/local/lib/python2.7/test/support/__init__.pyt_save_and_block_modulels


cCst|i}g}t||zyax|D]}t||q3Wx-|D]%}t||sQ|j|qQqQWtj|}Wntk
rd}nXWdx'|jD]\}	}
|
t	j
|	<qWx|D]}t	j
|=qWX|SWdQXdS(sImports and returns a module, deliberately bypassing the sys.modules cache
    and importing a fresh copy of the module. Once the import is complete,
    the sys.modules cache is restored to its original state.

    Modules named in fresh are also imported anew if needed by the import.
    If one of these modules can't be imported, None is returned.

    Importing of modules named in blocked is prevented while the fresh import
    takes place.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(RDRUR[tappendRERRFRYtitemsRNRO(RJtfreshtblockedRKRStnames_to_removet
fresh_nametblocked_nametfresh_modulet	orig_nametmoduletname_to_remove((s1/usr/local/lib/python2.7/test/support/__init__.pyR6ys&





cCsyt||}Wntk
rt|tjrKd|j|f}nt|tjrsd|j|f}nit|tjrd|jj|f}n>t|t	rd|j|f}ndt	|j|f}t
j|nX|SdS(s?Get an attribute, raising SkipTest if AttributeError is raised.smodule %r has no attribute %rsclass %s has no attribute %rs%s instance has no attribute %rs"type object %r has no attribute %rs%r object has no attribute %rN(tgetattrtAttributeErrort
isinstancettypest
ModuleTypeR<t	ClassTypetInstanceTypet	__class__ttypeRGRH(tobjRJt	attributeRL((s1/usr/local/lib/python2.7/test/support/__init__.pyR4s
iicCs
|adS(N(t_original_stdout(tstdout((s1/usr/local/lib/python2.7/test/support/__init__.pyRscCs
tptjS(N(RrRNRs(((s1/usr/local/lib/python2.7/test/support/__init__.pyR	scCs&ytj|=Wntk
r!nXdS(N(RNRORW(RJ((s1/usr/local/lib/python2.7/test/support/__init__.pyR
s
cGsxy||SWnctk
rs}tdkrVd|jj|fGHd|j|fGHntj|tj||SXdS(Nis%s: %ssre-run %s%r(tEnvironmentErrorRRnR<tostchmodtstattS_IRWXU(tpathtfunctargsterr((s1/usr/local/lib/python2.7/test/support/__init__.pyt
_force_runstwincCs|||r|}n$tjj|\}}|p:d}d}xR|dkrtj|}|rm|n	||ks}dStj||d9}qFWtjd|tdddS(NRMgMbP?g?is)tests may fail, delete still pending for t
stackleveli(	RuRytsplittlistdirttimetsleepR@twarntRuntimeWarning(RztpathnametwaitalltdirnameRJttimeouttL((s1/usr/local/lib/python2.7/test/support/__init__.pyt_waitfors
	

cCsttj|dS(N(RRuR(tfilename((s1/usr/local/lib/python2.7/test/support/__init__.pyt_unlinkscCsttj|dS(N(RRutrmdir(R((s1/usr/local/lib/python2.7/test/support/__init__.pyt_rmdirscs6fdt|dttd|dS(Ncsxt|tj|D]i}tjj||}tjj|rlt|dtt|tj|qt|tj	|qWdS(NR(
R}RuRRytjointisdirRRVRR(RyRJtfullname(t
_rmtree_inner(s1/usr/local/lib/python2.7/test/support/__init__.pyRsRcSst|tj|S(N(R}RuR(tp((s1/usr/local/lib/python2.7/test/support/__init__.pyt<lambda>t(RRV(Ry((Rs1/usr/local/lib/python2.7/test/support/__init__.pyt_rmtreescsSytj|dSWntk
r(nXfd|tj|dS(Ncsxt|tj|D]}tjj||}ytj|j}Wntk
r`d}nXtj	|r|t|tj
|qt|tj|qWdS(Ni(R}RuRRyRtlstattst_modeRtRwtS_ISDIRRR(RyRJRtmode(R(s1/usr/local/lib/python2.7/test/support/__init__.pyRs


(tshutilRRtRuR(Ry((Rs1/usr/local/lib/python2.7/test/support/__init__.pyRs


cCsIyt|Wn4tk
rD}|jtjtjfkrEqEnXdS(N(RtOSErrorterrnotENOENTtENOTDIR(Rtexc((s1/usr/local/lib/python2.7/test/support/__init__.pyR"s
cCs@yt|Wn+tk
r;}|jtjkr<q<nXdS(N(RRRR(Rterror((s1/usr/local/lib/python2.7/test/support/__init__.pyR)s
cCsIyt|Wn4tk
rD}|jtjtjfkrEqEnXdS(N(RRRRtESRCH(Ryte((s1/usr/local/lib/python2.7/test/support/__init__.pyR1s
cCsjt|xYtjD]N}ttjj||tjdttjj||tjdqWdS(sm"Forget" a module was ever imported by removing it from sys.modules and
    deleting any .pyc and .pyo files.tpyctpyoN(R
RNRyRRuRtextsep(RTR((s1/usr/local/lib/python2.7/test/support/__init__.pyR
9s
$csttdrtjSd}tjjdr ddlddld}d}dj	ffdY}j
j}|j}|sj
n|}jj}|j||j|j|j|}|sj
nt|j|@sd}qntjdkrdd	lm}	mm}
m	}dd
lm}|	j|d}
|
jdkrd
}qd|ffdY}|}|
|}|
j|dks|
j|dkrd}qn|sy;ddlm}|}|j |j!|j"Wqt#k
r}t$|}t%|dkrz|d d}ndj&t'|j(|}qXn|t_)|t_tjS(NtresultR~iitUSEROBJECTFLAGScs;eZdjjfdjjfdjjfgZRS(tfInheritt	fReservedtdwFlags(R<R=twintypestBOOLtDWORDt_fields_((tctypes(s1/usr/local/lib/python2.7/test/support/__init__.pyRPss,gui not available (WSF_VISIBLE flag not set)tdarwin(tcdlltc_inttpointert	Structure(tfind_librarytApplicationServicesis0gui tests cannot run without OS X window managertProcessSerialNumbercs eZdfdfgZRS(t
highLongOfPSNtlowLongOfPSN(R<R=R((R(s1/usr/local/lib/python2.7/test/support/__init__.pyRrs	s#cannot run without OS X gui process(tTki2s [...]sTk unavailable due to {}: {}(*thasattrt_is_gui_availableRRYRNtplatformRRRtctypes.wintypesRtwindlltuser32tGetProcessWindowStationtWinErrorRRtGetUserObjectInformationWtbyreftsizeoftboolRRRRtctypes.utilRtLoadLibrarytCGMainDisplayIDtGetCurrentProcesstSetFrontProcesstTkinterRtwithdrawtupdatetdestroyt	ExceptionRItlentformatRoR<treason(Rt	UOI_FLAGStWSF_VISIBLERtdllthtuoftneededtresRRRRtapp_servicesRtpsntpsn_pRtrootRt
err_string((RRs1/usr/local/lib/python2.7/test/support/__init__.pyREsh		"			

	
cCstdkp|tkS(sTest whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N(RRY(tresource((s1/usr/local/lib/python2.7/test/support/__init__.pyRscCs`t|s4|dkr%d|}nt|n|dkr\tr\ttjndS(s@Raise ResourceDenied if the specified resource is not available.s$Use of the `%s' resource not enabledtguiN(RRYRRR(RRL((s1/usr/local/lib/python2.7/test/support/__init__.pyRs
csfd}|S(sDecorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    cs.tjfd}|_|S(Ncstjdkrtjd}y"ttt|jd}Wntk
rTqX|krdjtt	}t
jd||fqn||S(NRiRMs&Mac OS X %s or higher required, not %s(RNRtmac_verttupletmaptintRt
ValueErrorRRIRGRH(R{tkwtversion_txttversiontmin_version_txt(Rztmin_version(s1/usr/local/lib/python2.7/test/support/__init__.pytwrappers"
(t	functoolstwrapsR(RzR(R(Rzs1/usr/local/lib/python2.7/test/support/__init__.pyt	decorators!	((RR((Rs1/usr/local/lib/python2.7/test/support/__init__.pyRss	127.0.0.1s::1cCs/tj||}t|}|j~|S(s
Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    socket.error will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it.(tsocketRtclose(tfamilytsocktypettempsocktport((s1/usr/local/lib/python2.7/test/support/__init__.pyRs
6
cCs|jtjkr|jtjkrttdrc|jtjtjdkrct	dqcnttdry1|jtjtj
dkrt	dnWqtk
rqXnttdr|jtjtj
dqn|j|df|jd}|S(s%Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    tSO_REUSEADDRisHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!tSO_REUSEPORTsHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!tSO_EXCLUSIVEADDRUSEi(RRtAF_INETRotSOCK_STREAMRt
getsockoptt
SOL_SOCKETRRRRtt
setsockoptRtbindtgetsockname(tsockthostR((s1/usr/local/lib/python2.7/test/support/__init__.pyRs$
cCs{tjrwd}zNy3tjtjtj}|jtdftSWntjk
r[nXWd|rs|j	nXnt
S(s+Check whether IPv6 is enabled on this host.iN(Rthas_ipv6RYtAF_INET6RRtHOSTv6RVRRRX(R((s1/usr/local/lib/python2.7/test/support/__init__.pyt_is_ipv6_enabled"s	cs"tjfd}|S(s5Skip the test on TLS certificate validation failures.csRy||Wn:tk
rM}dt|krGtjdnnXdS(NtCERTIFICATE_VERIFY_FAILEDs.system does not contain necessary certificates(tIOErrorRIRGRH(R{tkwargsR(tf(s1/usr/local/lib/python2.7/test/support/__init__.pytdec5s(RR(RR((Rs1/usr/local/lib/python2.7/test/support/__init__.pytsystem_must_validate_cert3s	gư>cCs#t|tst|trcy8t|t|t}t|||krUdSWqqXnt|t|krt|ttfrxPttt	|t	|D]-}t
||||}|dkr|SqWt	|t	|kt	|t	|kS||k||kS(Ni(RitfloattabsRRoRRQtrangetminRR(txtytfuzztitoutcome((s1/usr/local/lib/python2.7/test/support/__init__.pyRBs-(,iiitjavasno unicode supportcCs
t|dS(Nsunicode-escape(tunicode(ts((s1/usr/local/lib/python2.7/test/support/__init__.pytuksii0iAiiiii*iii s$testtriscosttestfiles@testRs@test-slatin-1tgetwindowsversioniis'u"@test-\u5171\u6709\u3055\u308c\u308b"tLatin1sgWARNING: The filename %r CAN be encoded by the filesystem.  Unicode filename tests may not be effectives	{}_{}_tmpshttp://www.pythontest.netccsQt}|dkrEddl}|j}t}tjj|}ntrt	|t
rtjjry|jt
jpd}Wqtk
r|stjdqqXnytj|t}Wn7tk
r|sntjd|tddnX|rtj}nz	|VWd|rL|tjkrLt|nXdS(sReturn a context manager that creates a temporary directory.

    Arguments:

      path: the directory to create temporarily.  If omitted or None,
        defaults to creating a temporary directory using tempfile.mkdtemp.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, if the path is specified and cannot be
        created, only a warning is issued.

    iNtasciis;unable to encode the cwd name with the filesystem encoding.s+tests may fail, unable to create temp dir: Ri(RXRYttempfiletmkdtempRVRuRytrealpathRRiRtsupports_unicode_filenamestencodeRNtgetfilesystemencodingtUnicodeEncodeErrorRGRHtmkdirRR@RRtgetpidR(Rytquiettdir_createdR tpid((s1/usr/local/lib/python2.7/test/support/__init__.pyttemp_dirs6





	ccs{tj}ytj|Wn7tk
rV|s9ntjd|tddnXztjVWdtj|XdS(sgReturn a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    s)tests may fail, unable to change CWD to: RiN(RutgetcwdtchdirRR@RR(RyR)t	saved_dir((s1/usr/local/lib/python2.7/test/support/__init__.pyt
change_cwd	s


ttempcwdc	csBtd|d|'}t|d|}|VWdQXWdQXdS(s
    Context manager that temporarily creates and changes the CWD.

    The function temporarily changes the current working directory
    after creating a temporary directory in the current directory with
    name *name*.  If *name* is None, the temporary directory is
    created using tempfile.mkdtemp.

    If *quiet* is False (default) and it is not possible to
    create or change the CWD, an error is raised.  If *quiet* is True,
    only a warning is raised and the original CWD is used.

    RyR)N(R,R0(RJR)t	temp_pathtcwd_dir((s1/usr/local/lib/python2.7/test/support/__init__.pyR$stdatacCstjj|r|S|dk	r:tjj||}ntgtj}x9|D]1}tjj||}tjj|rQ|SqQW|S(sTry to find a file on sys.path and the working directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).N(RuRytisabsRYRt
TEST_HOME_DIRRNtexists(tfiletsubdirRytdntfn((s1/usr/local/lib/python2.7/test/support/__init__.pyR?s
cCsJ|j}|jg|D]}d|^q}dj|}d|S(s%Like repr(dict), but in sorted order.s%r: %rs, s{%s}(R]tsortR(tdictR]tpairt	reprpairst
withcommas((s1/usr/local/lib/python2.7/test/support/__init__.pyRMs

cCs9ttd}z|jSWd|jttXdS(s`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    twbN(topenRtfilenoRR(R8((s1/usr/local/lib/python2.7/test/support/__init__.pytmake_bad_fdUs

cCs||jt|}t|ddWdQX|j}|dk	rV|j|j|n|dk	rx|j|j|ndS(Ns
<test string>texec(tassertRaisesRegexptSyntaxErrortcompilet	exceptionRYtassertEqualtlinenotoffset(ttestcaset	statementterrtextRKRLtcmR|((s1/usr/local/lib/python2.7/test/support/__init__.pyRas	c
sSddl}ddl}|j|djdd}tjjt|}fd}tjj|r||}|dk	r|St	|nt
dtd|IJ|j|dd}zNt
|d	9}|j}	x#|	r
|j|	|j}	qWWdQXWd|jX||}|dk	r?|Std
|dS(Niit/csGt|}dkr|S|r9|jd|S|jdS(Ni(RBRYtseekR(R;R(tcheck(s1/usr/local/lib/python2.7/test/support/__init__.pytcheck_valid_fileqs
turlfetchs	fetching %s ...RiRAsinvalid resource "%s"(turlparseturllib2RRuRyRt
TEST_DATA_DIRR7RYRRR	turlopenRBtreadtwriteRR(
turlRSRVRWRR;RTRtoutR((RSs1/usr/local/lib/python2.7/test/support/__init__.pyRjs. 	

	
tWarningsRecordercBs8eZdZdZdZedZdZRS(syConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS(Ni(t	_warningst_last(tselft
warnings_list((s1/usr/local/lib/python2.7/test/support/__init__.pyt__init__s	cCs\t|j|jkr,t|jd|S|tjjkrBdStd||fdS(Nis%r has no attribute %r(	RR_R`RgR@tWarningMessaget_WARNING_DETAILSRYRh(Ratattr((s1/usr/local/lib/python2.7/test/support/__init__.pyt__getattr__s
cCs|j|jS(N(R_R`(Ra((s1/usr/local/lib/python2.7/test/support/__init__.pyR@scCst|j|_dS(N(RR_R`(Ra((s1/usr/local/lib/python2.7/test/support/__init__.pytresets(R<R=R>RcRgtpropertyR@Rh(((s1/usr/local/lib/python2.7/test/support/__init__.pyR^s
		c
csptjd}|jjd}|r4|jntjdt&}tjdj	dt
|VWdQXg|D]}|j^qu}g}x|D]\}}	t}
x[|D]R}t
|}tj||tjrt|j|	rt}
|j|qqW|
r|r|j||	jfqqW|rOtd|dn|rltd	|dndS(
sCatch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    it__warningregistry__trecordR@talwaysNsunhandled warning %ris)filter (%r, %s) did not catch any warning(RNt	_getframet	f_globalstgettclearR@RARVROtsimplefilterR^tmessageRXRItretmatchtIt
issubclassRntremoveR\R<tAssertionError(
tfiltersR)tframetregistrytwtwarningtreraisetmissingRLtcattseenRRr((s1/usr/local/lib/python2.7/test/support/__init__.pyt_filterwarningss0
cOsI|jd}|s<dtff}|dkr<t}q<nt||S(sContext manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    R)RN(RotWarningRYRVR(RyR
R)((s1/usr/local/lib/python2.7/test/support/__init__.pyRscOs@tjr$|s*dtff}q*nd}t||jdS(sjContext manager to silence py3k warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default False)

    Without argument, it defaults to:
        check_py3k_warnings(("", DeprecationWarning), quiet=False)
    RR)((RNtpy3kwarningRCRRo(RyR
((s1/usr/local/lib/python2.7/test/support/__init__.pyR s
	cBs)eZdZdZdZdZRS(s,Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    cGsotjj|_xV|D]N}|tjkrtj|}|j|krZtj|j=ntj|=qqWdS(N(RNROtcopytoriginal_modulesR<(Ratmodule_namestmodule_nameRe((s1/usr/local/lib/python2.7/test/support/__init__.pyRc
s

cCs|S(N((Ra((s1/usr/local/lib/python2.7/test/support/__init__.pyt	__enter__scGstjj|jdS(N(RNRORR(Rat
ignore_exc((s1/usr/local/lib/python2.7/test/support/__init__.pyt__exit__s(R<R=R>RcRR(((s1/usr/local/lib/python2.7/test/support/__init__.pyR!s
	
	cBs_eZdZdZdZdZdZdZdZdZ	dZ
d	ZRS(
s_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS(N(Rutenviront_environt_changed(Ra((s1/usr/local/lib/python2.7/test/support/__init__.pyRc&scCs|j|S(N(R(Ratenvvar((s1/usr/local/lib/python2.7/test/support/__init__.pyt__getitem__*scCs<||jkr+|jj||j|<n||j|<dS(N(RRRo(RaRtvalue((s1/usr/local/lib/python2.7/test/support/__init__.pyt__setitem__-scCsK||jkr+|jj||j|<n||jkrG|j|=ndS(N(RRRo(RaR((s1/usr/local/lib/python2.7/test/support/__init__.pyt__delitem__3scCs
|jjS(N(Rtkeys(Ra((s1/usr/local/lib/python2.7/test/support/__init__.pyR:scCs|||<dS(N((RaRR((s1/usr/local/lib/python2.7/test/support/__init__.pytset=scCs||=dS(N((RaR((s1/usr/local/lib/python2.7/test/support/__init__.pytunset@scCs|S(N((Ra((s1/usr/local/lib/python2.7/test/support/__init__.pyRCscGshxU|jjD]D\}}|dkrG||jkrT|j|=qTq||j|<qW|jt_dS(N(RR]RYRRuR(RaRtktv((s1/usr/local/lib/python2.7/test/support/__init__.pyRFs(R<R=R>RcRRRRRRRR(((s1/usr/local/lib/python2.7/test/support/__init__.pyR"!s								t
DirsOnSysPathcBs)eZdZdZdZdZRS(sContext manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    cGs-tj|_tj|_tjj|dS(N(RNRytoriginal_valuetoriginal_objecttextend(Ratpaths((s1/usr/local/lib/python2.7/test/support/__init__.pyRc\s
cCs|S(N((Ra((s1/usr/local/lib/python2.7/test/support/__init__.pyRascGs|jt_|jtj(dS(N(RRNRyR(RaR((s1/usr/local/lib/python2.7/test/support/__init__.pyRds(R<R=R>RcRR(((s1/usr/local/lib/python2.7/test/support/__init__.pyRPs
		cBs2eZdZdZdZddddZRS(sRaise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS(N(Rtattrs(RaRR
((s1/usr/local/lib/python2.7/test/support/__init__.pyRcns	cCs|S(N((Ra((s1/usr/local/lib/python2.7/test/support/__init__.pyRrscCs}|dk	ryt|j|ryxX|jjD]8\}}t||sMPnt|||kr.Pq.q.WtdndS(sIf type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).s%an optional resource is not availableN(RYRvRRt	iteritemsRRgR(Rattype_Rt	tracebackRft
attr_value((s1/usr/local/lib/python2.7/test/support/__init__.pyRusN(R<R=R>RcRRYR(((s1/usr/local/lib/python2.7/test/support/__init__.pyR%is		g>@c#sdddd d!d"g}d#d$d%d&d'g}td||gsg|D]\}}tt||^qVg|D]\}}tt||^qnfd}tj}zy%|dk	rtj|ndVWntk
r}	xxtr}|	j	}
t
|
dkrGt|
dtrG|
d}	qt
|
dkryt|
dtry|
d}	qPqW||	nXWdtj|XdS((sReturn a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.tECONNREFUSEDiot
ECONNRESETihtEHOSTUNREACHiqtENETUNREACHiet	ETIMEDOUTint
EADDRNOTAVAILict	EAI_AGAINitEAI_FAILit
EAI_NONAMEit
EAI_NODATAit
WSANO_DATAi*sResource '%s' is not availablecst|dd}t|tjsNt|tjrB|ksN|kr{tsrtjj	j
ddnndS(NRis
(RgRYRiRRtgaierrorRRNtstderrR[R{(R|tn(tcaptured_errnostdeniedt
gai_errnos(s1/usr/local/lib/python2.7/test/support/__init__.pytfilter_errorsNiii(Rio(Rih(Riq(Rie(Rin(Ric(Ri(Ri(Ri(Ri(Ri*(RRgRRtgetdefaulttimeoutRYtsetdefaulttimeoutR	RVR{RRi(t
resource_nameRterrnostdefault_errnostdefault_gai_errnosRJtnumRtold_timeoutR|ta((RRRs1/usr/local/lib/python2.7/test/support/__init__.pyR&sJ		(+				%
%

ccs[ddl}tt|}tt||jztt|VWdtt||XdS(sReturn a context manager used by captured_stdout and captured_stdin
    that temporarily replaces the sys stream *stream_name* with a StringIO.iN(tStringIORgRNtsetattr(tstream_nameRtorig_stdout((s1/usr/local/lib/python2.7/test/support/__init__.pyR#scCs
tdS(sCapture the output of sys.stdout:

       with captured_stdout() as s:
           print "hello"
       self.assertEqual(s.getvalue(), "hello")
    Rs(R#(((s1/usr/local/lib/python2.7/test/support/__init__.pyR$scCs
tdS(NR(R#(((s1/usr/local/lib/python2.7/test/support/__init__.pytcaptured_stderrscCs
tdS(Ntstdin(R#(((s1/usr/local/lib/python2.7/test/support/__init__.pytcaptured_stdinscCs8tjtr tjdntjtjdS(sForce as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    g?N(tgctcollectRRR(((s1/usr/local/lib/python2.7/test/support/__init__.pyt
gc_collects



t2PtgettotalrefcounttPcCstjt|dS(Nt0P(tstructtcalcsizet_header(tfmt((s1/usr/local/lib/python2.7/test/support/__init__.pytcalcobjsizescCstjt|dS(NR(RRt_vheader(R((s1/usr/local/lib/python2.7/test/support/__init__.pytcalcvobjsizesii	cCsddl}tj|}t|tkr:|jt@s_t|tkrot|jt@ro||j7}ndt|||f}|j|||dS(Nis&wrong size for %s: got %d, expected %d(	t	_testcapiRNt	getsizeofRot	__flags__t_TPFLAGS_HEAPTYPEt_TPFLAGS_HAVE_GCtSIZEOF_PYGC_HEADRJ(ttesttotsizeRRRL((s1/usr/local/lib/python2.7/test/support/__init__.pytcheck_sizeofs%csfd}|S(Ncs1fd}j|_j|_|S(Ncsy.ddl}t|}|j|}Wn$tk
rDnAd}}n1Xx-D]%}y|j||PWq\q\Xq\Wz||SWd|r|r|j||nXdS(Ni(tlocaleRgt	setlocaleRhRY(R{tkwdsRtcategorytorig_localetloc(tcatstrRztlocales(s1/usr/local/lib/python2.7/test/support/__init__.pytinners$

(t	func_nameR>(RzR(RR(Rzs1/usr/local/lib/python2.7/test/support/__init__.pyRs((RRR((RRs1/usr/local/lib/python2.7/test/support/__init__.pyR'scsfd}|S(Ncs.fd}j|_j|_|S(Ncsy
tj}Wn tk
r/tjdnXdtjkrOtjd}nd}tjd<|z||SWd|dkrtjd=n
|tjd<tjXdS(Nstzset requiredtTZ(RttzsetRhRGRHRuRRY(R{RRtorig_tz(Rzttz(s1/usr/local/lib/python2.7/test/support/__init__.pyR9s




(R<R>(RzR(R(Rzs1/usr/local/lib/python2.7/test/support/__init__.pyR8s((RR((Rs1/usr/local/lib/python2.7/test/support/__init__.pyR:7scCsidd6td6td6dtd6}tjd|tjtjB}|dkrgtd|fntt	|j
d||j
d	j}|a|t
krt
}n|tdkrtd
|fn|adS(NiRtmtgtts(\d+(\.\d+)?) (K|M|G|T)b?$sInvalid memory limit %riis$Memory limit %r too low to be useful(t_1Mt_1GRsRtt
IGNORECASEtVERBOSERYRRRtgrouptlowertreal_max_memusetMAX_Py_ssize_tt_2GR(tlimittsizesRtmemlimit((s1/usr/local/lib/python2.7/test/support/__init__.pyR(`s 2	icsfd}|S(sQDecorator for bigmem tests.

    'minsize' is the minimum useful size for the test (in arbitrary,
    test-interpreted units.) 'memuse' is the number of 'bytes per size' for
    the test, or a good estimate of it. 'overhead' specifies fixed overhead,
    independent of the testsize, and defaults to 5Mb.

    The decorator tries to guess a good value for 'size' and passes it to
    the decorated test function. If minsize * memuse is more than the
    allowed memory use (as defined by max_memuse), the test is skipped.
    Otherwise, minsize is adjusted upward to use up to max_memuse.
    cs7fd}|_|_|_|S(Ncsts.d}|j|dtkn^tt}|krutrqtjjdjfndSt	|dt}||S(Niis)Skipping %s because of memory constraint
i2(
RtassertFalseRRRRNRR[R<tmax(Ratmaxsize(Rtmemusetminsizetoverhead(s1/usr/local/lib/python2.7/test/support/__init__.pyRs"(RRR(RR(RRR(Rs1/usr/local/lib/python2.7/test/support/__init__.pyRs
			((RRRR((RRRs1/usr/local/lib/python2.7/test/support/__init__.pyR)us
csfd}|S(Ncs7fd}|_|_|_|S(Ncsftsd}n}ts"rYt|krYtrUtjjdjfndS||S(Nis)Skipping %s because of memory constraint
(RRRNRR[R<(RaR(tdry_runRRR(s1/usr/local/lib/python2.7/test/support/__init__.pyRs	
(RRR(RR(RRRR(Rs1/usr/local/lib/python2.7/test/support/__init__.pyRs
			((RRRRR((RRRRs1/usr/local/lib/python2.7/test/support/__init__.pytprecisionbigmemtestscsfd}|S(s0Decorator for tests that fill the address space.cs@ttkr2tr<tjjdjfq<n
|SdS(Ns)Skipping %s because of memory constraint
(RRRRNRR[R<(Ra(R(s1/usr/local/lib/python2.7/test/support/__init__.pyRs
((RR((Rs1/usr/local/lib/python2.7/test/support/__init__.pyR*scBseZdZRS(cCstj}|||S(N(RGt
TestResult(RaRR((s1/usr/local/lib/python2.7/test/support/__init__.pytruns
(R<R=R(((s1/usr/local/lib/python2.7/test/support/__init__.pyR+scCs|S(N((Rp((s1/usr/local/lib/python2.7/test/support/__init__.pyt_idscCsP|dkr&tr&tjtjSt|r6tStjdj|SdS(NRsresource {0!r} is not enabled(RRGtskipRRRR(R((s1/usr/local/lib/python2.7/test/support/__init__.pytrequires_resources
cCstdt|S(s9
    Decorator for tests only applicable on CPython.
    tcpython(timpl_detailRV(R((s1/usr/local/lib/python2.7/test/support/__init__.pyR2scKs}t|rtS|dkrpt|\}}|r=d}nd}t|j}|jdj|}ntj	|S(Ns*implementation detail not available on {0}s%implementation detail specific to {0}s or (
R3RRYt
_parse_guardstsortedRRRRGR(RLtguardst
guardnamestdefault((s1/usr/local/lib/python2.7/test/support/__init__.pyRs	cCsW|sitd6tfS|jd}|j|gt|ksLt||fS(NRi(RVRXtvaluesRRx(Rtis_true((s1/usr/local/lib/python2.7/test/support/__init__.pyR	s
%cKs.t|\}}|jtjj|S(s5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    (R	RoRtpython_implementationR(RR
((s1/usr/local/lib/python2.7/test/support/__init__.pyR3scCsrg}x\|jD]Q}t|tjrEt|||j|q||r|j|qqW||_dS(s>Recursively filter test cases in a suite based on a predicate.N(t_testsRiRGt	TestSuitet
_filter_suiteR\(tsuitetpredtnewtestsR((s1/usr/local/lib/python2.7/test/support/__init__.pyRs
cCstr'tjtjdddt}n	t}|j|}|jr\|j	r\t
n|jst|j
dkr|jr|j
dd}nLt|jdkr|j
r|jdd}nd}ts|d7}nt|ndS(	s2Run tests from a unittest.TestSuite-derived class.t	verbosityitfailfastiismultiple errors occurreds!; run in verbose mode for detailsN(RRGtTextTestRunnerRNRsRR+RttestsRuntskippedRt
wasSuccessfulRterrorstfailuresR(RtrunnerRR|((s1/usr/local/lib/python2.7/test/support/__init__.pyt
_run_suites 		
cCs$tdkrtSt|jSdS(N(t_match_test_funcRYRVtid(R((s1/usr/local/lib/python2.7/test/support/__init__.pyt
match_test!scCsd|kotjd|S(NRMs[?*\[\]](Rstsearch(tpattern((s1/usr/local/lib/python2.7/test/support/__init__.pyt_is_full_match_test)scs|tkrdS|s%d}d}nittt|rLt|j}nBdjttj	|}t
j|jfd}|}t
|a|adS(Nt|cs0|rtStt|jdSdS(NRM(RVtanyRR(ttest_id(tregex_match(s1/usr/local/lib/python2.7/test/support/__init__.pytmatch_test_regexHs((t_match_test_patternsRYtallRR&Rt__contains__Rtfnmatcht	translateRsRHRtRR!(tpatternsRztregexR+((R*s1/usr/local/lib/python2.7/test/support/__init__.pytset_match_tests3s	cGstjtjf}tj}x|D]}t|trx|tjkri|jtjtj|qt	dq%t||r|j|q%|jtj
|q%Wt|tt
|dS(s1Run tests from unittest.TestCase-derived classes.s)str arguments must be keys in sys.modulesN(RGRtTestCaseRiRIRNROtaddTestt
findTestCasesRt	makeSuiteRR#R (tclassestvalid_typesRtcls((s1/usr/local/lib/python2.7/test/support/__init__.pyR,[s
 
Rtwin32tWITH_DOC_STRINGSstest requires docstringscCsddl}|dkr!t}nd}tj}tt_z>|j|d|\}}|rytd||fnWd|t_Xtrd|j|fGHn||fS(s
Run doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    test.support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    iNRs%d of %d doctests faileds,doctest (%s) ... %d tests with zero failures(	tdoctestRYRRNRsR	ttestmodRR<(ReRR=tsave_stdoutRR((s1/usr/local/lib/python2.7/test/support/__init__.pyR-zs		
cCstrtjfSdSdS(Ni(i(tthreadt_count(((s1/usr/local/lib/python2.7/test/support/__init__.pyR.s
cCsTts
dSd}x=t|D]/}tj}||kr?PntjdqWdS(Ni
g?(R@RRARR(t
nb_threadst
_MAX_COUNTtcountR((s1/usr/local/lib/python2.7/test/support/__init__.pyR/scs,ts
Stjfd}|S(sUse this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    If threading is unavailable this function does nothing.
    cs)t}z|SWdt|XdS(N(R.R/(R{tkey(Rz(s1/usr/local/lib/python2.7/test/support/__init__.pyRs	(R@RR(RzR((Rzs1/usr/local/lib/python2.7/test/support/__init__.pyR0sgN@ccstj}z	dVWdtj}||}xtrtj}||krSPntj|krtj|}d|||||f}t|ntjdtq1WXdS(sE
    bpo-31234: Context manager to wait until all threads created in the with
    statement exit.

    Use thread.count() to check if threads exited. Indirectly, wait until
    threads exit the internal t_bootstrap() C function of the thread module.

    threading_setup() and threading_cleanup() are designed to emit a warning
    if a test leaves running threads in the background. This context manager
    is designed to cleanup threads started by the thread.start_new_thread()
    which doesn't allow to wait for thread exit, whereas thread.Thread has a
    join() method.
    NsYwait_threads() failed to cleanup %s threads after %.1f seconds (count: %s, old count: %s)g{Gz?(R@RARRVRxRR(Rt	old_countt
start_timetdeadlineRDtdtRL((s1/usr/local/lib/python2.7/test/support/__init__.pytwait_threads_exits 	
	
cCscttdr_d}xGtr[y/tj|tj\}}|dkrLPnWqPqXqWndS(sUse this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    twaitpidiiN(RRuRVRKtWNOHANG(tany_processR+tstatus((s1/usr/local/lib/python2.7/test/support/__init__.pyR7s		c	cst|}g}zfy,x%|D]}|j|j|qWWn.trkdt|t|fGHnnXdVWd|r|ntj}}xtddD]}|d7}x.|D]&}|jt|tjdqWg|D]}|j	r|^q}|sPntrdt||fGHqqWXg|D]}|j	rE|^qE}|rt
dt|ndS(Ns/Can't start %d threads, only %d threads startediii<g{Gz?s7Unable to join %d threads during a period of %d minutessUnable to join %d threads(RQtstartR\RRRRRRtisAliveRx(tthreadstunlocktstartedRtendtimet	starttimeR((s1/usr/local/lib/python2.7/test/support/__init__.pyR1s:

	


$%%ccst||rNt||}t|||z	|VWdt|||Xn<t|||z	dVWdt||rt||nXdS(sTemporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N(RRgRtdelattr(RpRftnew_valtreal_val((s1/usr/local/lib/python2.7/test/support/__init__.pyt	swap_attr's		ccsk||kr:||}|||<z	|VWd|||<Xn-|||<z	dVWd||krf||=nXdS(sTemporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N((RptitemRWRX((s1/usr/local/lib/python2.7/test/support/__init__.pyt	swap_itemFs

	
	cCs\y|jSWnGtk
rWydjd|DSWqXtk
rSt|SXnXdS(sZEmulate the py3k bytes() constructor.

    NOTE: This is only a best effort function.
    Rcss|]}t|VqdS(N(tchr(t.0R((s1/usr/local/lib/python2.7/test/support/__init__.pys	<genexpr>psN(ttobytesRhRt	TypeErrortbytes(tb((s1/usr/local/lib/python2.7/test/support/__init__.pyR5es

t	getcountss-types are immortal if COUNT_ALLOCS is definedcCsddl}|jS(sZReturn a list of command-line arguments reproducing the current
    settings in sys.flags.iN(t
subprocesst_args_from_interpreter_flags(Rc((s1/usr/local/lib/python2.7/test/support/__init__.pytargs_from_interpreter_flagswscCstjdd|j}|S(sStrip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    s\[\d+ refs\]\r?\n?$R(Rstsubtstrip(R((s1/usr/local/lib/python2.7/test/support/__init__.pyR8}scsid|ffdY}tg||||jttt|jddS(NtAcseZfdZRS(cs0td<ytWntk
r+nXdS(Ni(RVtnextt
StopIteration(Ra(tdonetit(s1/usr/local/lib/python2.7/test/support/__init__.pyt__del__s


(R<R=Rm((RkRl(s1/usr/local/lib/python2.7/test/support/__init__.pyRhsi(RXtassertRaisesRjRiRt
assertTrue(RtiterR:R{Rh((RkRls1/usr/local/lib/python2.7/test/support/__init__.pytcheck_free_after_iteratings	ccs:tj}tjz	dVWd|r5tjnXdS(N(Rt	isenabledtdisabletenable(thave_gc((s1/usr/local/lib/python2.7/test/support/__init__.pyt
disable_gcs
	cCsTtjdpd}d}x,|jD]}|jdr(|}q(q(W|dkS(s,Find if Python was built with optimizations.t	PY_CFLAGSRs-Os-O0s-Og(Rs-O0s-Og(t	sysconfigtget_config_varRRR(tcflagst	final_opttopt((s1/usr/local/lib/python2.7/test/support/__init__.pytpython_is_optimizeds
cBs,eZdZdZdZdZdZRS(sTry to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    cCstjjdrddl}|jj|_d}|jj||_|jj|j|Byddl	}|j
Wnttfk
rqXi|_
x|j|j|jgD]C}|j
||j}|j||j}||f|j
|<qWnyddl}Wntk
r%d}nX|dk	ry9|j|j|_|j|jd|jdfWqttfk
rqXntjdkrddl}dd	d
dg}	|j|	d|jd
|j}
|
jd}|jdkrtj j!dtj j"qn|S(sOn Windows, disable Windows Error Reporting dialogs using
        SetErrorMode.

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        R~iNiiiRs/usr/bin/defaultsRZscom.apple.CrashReportert
DialogTypeRsRt	developers:this test triggers the Crash Reporter, that is intentional(#RNRRRRRtkernel32t_k32tSetErrorModet	old_valueRtCrtSetReportModeRhRFt	old_modestCRT_WARNt	CRT_ERRORt
CRT_ASSERTtCRTDBG_MODE_FILEtCrtSetReportFiletCRTDBG_FILE_STDERRRRYt	getrlimittRLIMIT_COREt	setrlimitRRRctPopentPIPEtcommunicateRgRsR[tflush(RaRtSEM_NOGPFAULTERRORBOXRtreport_typetold_modetold_fileRRctcmdtprocRs((s1/usr/local/lib/python2.7/test/support/__init__.pyRsV				

	cGs|jdkrdStjjdr|jj|j|jrddl}xF|jj	D]2\}\}}|j
|||j||q]Wqn@ddl}y|j
|j|jWnttfk
rnXdS(sARestore Windows ErrorMode or core file behavior to initial value.NR~i(RRYRNRRRRRRRR]RRRRRRR(RaRRRRRR((s1/usr/local/lib/python2.7/test/support/__init__.pyRs	"N(R<R=R>RYRRRR(((s1/usr/local/lib/python2.7/test/support/__init__.pyR;s
	GcCs*ddl}t|jWdQXdS(sDeliberate crash of Python.

    Python can be killed by a segmentation fault (SIGSEGV), a bus error
    (SIGBUS), or a different error depending on the platform.

    Use SuppressCrashReport() to prevent a crash report from popping up.
    iN(RR;t
_read_null(R((s1/usr/local/lib/python2.7/test/support/__init__.pyt
_crash_pythons	
c
Cstjjdrdy!tjd}t|dSWqdtk
r`}|jtjkraqaqdXnd}t	tdrytj
d}Wqtk
rqXnd
}tjdkr+yd	d
l}|j
Wnttfk
rq+Xi}x9|j|j|jfD]}|j
|d||<qWnzyd}xlt|D]^}ytj|}Wn+tk
r}	|	jtjkrqqAXtj||d7}qAWWd
|d
k	rx7|j|j|jfD]}|j
|||qWnX|S(
s/Count the number of open file descriptors.
    tlinuxtfreebsds
/proc/self/fdiitsysconftSC_OPEN_MAXR;iNi(RR(RNRRRRuRRRRRRRRYtmsvcrtRRhRFRRRRtduptEBADFR(
tnamesRtMAXFDRRRRDtfdtfd2R((s1/usr/local/lib/python2.7/test/support/__init__.pytfd_count!sR

	

	tSaveSignalscBs)eZdZdZdZdZRS(s
    Save an restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    cCsddl}||_ttd|j|_xHdD]@}yt||}Wntk
rfq7nX|jj|q7Wi|_dS(NiitSIGKILLtSIGSTOP(RR(	tsignalRQRtNSIGtsignalsRgRhRwthandlers(RaRtsignametsignum((s1/usr/local/lib/python2.7/test/support/__init__.pyRcfs	

cCsIxB|jD]7}|jj|}|dkr4q
n||j|<q
WdS(N(RRt	getsignalRYR(RaRthandler((s1/usr/local/lib/python2.7/test/support/__init__.pytsavess
cCs7x0|jjD]\}}|jj||qWdS(N(RR]R(RaRR((s1/usr/local/lib/python2.7/test/support/__init__.pytrestores(R<R=R>RcRR(((s1/usr/local/lib/python2.7/test/support/__init__.pyR]s	
	((ii@i@i@ii(i@ii(((((R>R<RFt
contextlibRR/RRRRwRNRuRRR@RGREtUserDictRsRRRxRjR@RYt__all__RRRRRHRtcontextmanagerRVRDRXRRUR[R6R4RRRRRRrRR	R
R}RRRRRRRRRR
RRRRRRRRRRRR9R
RRt
PIPE_MAX_SIZEt
SOCK_MAX_SIZERRRt	NameErrort
skipUnlesstrequires_unicodeRtFS_NONASCIItunichrt	characterR$R%tdecodetUnicodeErrorRJRRitTESTFN_UNICODEtTESTFN_ENCODINGRRtTESTFN_UNENCODABLEtevalR&RR(t
TEST_HTTP_URLR-RR,R0RRyRtabspatht__file__tTEST_SUPPORT_DIRR6RRXRRRDRRtobjectR^RRR R!t	DictMixinR"RR%R&R#R$RRRRRRRRRRR'R:RRRt_4GRRR(R)RR*R+RRR2RR	R3RR R!R,R#R&R3R,RytHAVE_DOCSTRINGStrequires_docstringsR-tenvironment_alteredR.R/R0RJR7R1RYR[R5tskipIftrequires_type_collectingReR8RqRvR}R;RRR(((s1/usr/local/lib/python2.7/test/support/__init__.pyt<module>s

								
	
	
&					
!										J			<$			
	


												

				
	.			*' /D					

				$	"


		'				
	
					
	(			&
			#	 					
e		<

Zerion Mini Shell 1.0