ok

Mini Shell

Direktori : /lib64/python3.6/test/support/__pycache__/
Upload File :
Current File : //lib64/python3.6/test/support/__pycache__/__init__.cpython-36.pyc

3

��f����@s^
dZedkred��ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZ
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl!Z"ddl#Z#ddl$m%Z%yddl&Z&ddl'Z'Wnek
�rBdZ&dZ'YnXyddl(Z)Wnek
�rjdZ)YnXyddl*Z*Wnek
�r�dZ*YnXyddl+Z+Wnek
�r�dZ+YnXyddl,Z,Wnek
�r�dZ,YnXyddl-Z-Wnek
�r
dZ-YnXyddl.Z.Wnek
�r2dZ.YnXyddl/Z/Wnek
�rZdZ/YnXddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbg\Z0Gdcd�de1�Z2Gddd
�d
e2�Z3Gded�de2�Z4Gdfd�de j5�Z6ej7�dfdhdi��Z8�dgfdk�dld�Z9dmdn�Z:dodp�Z;dqd=�Z<drd>�Z=ffdjfdsd�Z>dtd9�Z?dZ@dZAdaBdaCdZDdjZEdaFdud�ZGdvd�ZHdwd�ZIdxdy�ZJejjKdz��r.�dhd{d|�ZLd}d~�ZMdd��ZNd�d��ZOd�d��ZPnejQZMejRZNd�d��ZOd�d��ZPd�d�ZQd�d��ZRd�d�ZSd�d��ZTd�d�ZUd�d��ZVd�d#�ZW�did�d$�ZXd�d��ZYd�d%�ZZd�d&�Z[d�d'�Z\�djd�d(�Z]d�Z^d�Z_ej`ejafd�dJ�Zbe^fd�dK�Zcd�dM�Zdd�d��Zeee�Zfd�d��Zg�dmZh�dpZie jjekjld��jKd��d��Zme jje*d��Zne jje+d��Zoe jje,d��Zpe jje-d��ZqejjKd��Zrejsd��Ztetdk	�oxetdkZuejd�k�r�eu�r�d�nd�ZvndZvejwd�k�r�d�Zxnd�Zxd�jyexejz��ZxdZ{xL�dqD]BZ|yej}ej~e|��e|k�r�e�Wnek
�rYnXe|Z{P�q�Wexd�Z�ejd�k�r:ddl�Z�e�j�d�e��Z�ej��Z�dZ�ejwd�k�r�ej��jd�k�r�exd�Z�ye�j�e��Wne�k
�r�YnXe�d�e�e�f�dZ�nBejd�k�r�yd�j�e��Wn&e�k
�r�exd�j�e�dǃZ�YnXdZ�xF�drD]<Zwyewj�e��Wn&e�k
�r,ej~ex�ewZ�PYnX�q�We{�rHexd�e{Z�ndZ�ej��Z�djZ�djZ�ej7�dsd�d΄�Z�ej7�dtd�dЄ�Z�ej7�dud�d��Z�e�edӃ�r�ej7d�dN��Z�ej�j�ej�j�e���Z�ej�j�e��Z�ej�j�e�dՃZ��dvd�d�Z�d�d �Z�d�d^�Z�d�dڄZ�dddۜd�d)�Z�d�dL�Z�Gd�d߄d�e��Z��dwd�d�Z�ej7d�dU��Z�ej7d�e�djfd�d��Z�ej7d�dV��Z�Gd�d�de��Z�Gd�dW�dWej�j��Z�Gd�d�d�e��Z�Gd�d*�d*e��Z�e�e�ej�d�Z�e�e�ej�d�Z�e�e�ej�d�Z�ej7d�fd�d�d.��Z�ej7d�d��Z�d�d�Z�d�d�Z�d�d�Z�d�d��Z�ej7d�d���Z�d�d��Z�d�Z�d�Z�e�ed���	rLd�e�Z�d�Z�e��dZd�d�ZÐd�d�ZĐdxZŐdyZƐd�d�Zǐd	dX�ZȐd
d_�ZɐdzZ�d�e�Z�d�e�Z�d�e�Z�ej�Zϐdd\�Z�G�d�d
��d
�Zѐd{�dd6�ZҐdd7�Z�G�dd/�d/�ZԐd�d�ZՐd�d�Z֐ddA�Zאdd8�Zؐd|�d�d�Z�daڐddB�Zېd�d�ZܐddE�Zݐd�d�Zސd�d �Zߐd!�d"�Z�d#�d$�Z�da�da�d%�d&�Z�d'�d(�Z�d)�d*�Z�d+d0�Z�d,�d-�Z�e݃�
o�ejd�k�
o�ejs�d.�Z�e�jdk	�oe�Z�e jje�d/�Z�d}�d0d1�Z�d1�d2�Z�d3�d4�Z�djZ�d5dQ�Z�d6dR�Z�d7dS�Z�ej7�d~�d9�d:��Z�d;dO�Z�ej7�d�d<dT��Z�ej7�d=dZ��Z�ej7�d>dY��Z��d?�d@�Z�e j�e�e�dA��dB�Z��dC�dD�Z��dE�dF�Z�G�dGdP�dPej�j��Z�G�dHd[�d[e���Zd�a�dId!��Z�dJd2��Zd�a�dK�dL��Z�dMd;��Z�dN�dO��Z�dPd"��Zf�dQ��dRd?��Z	dfff�dSd@��Z
G�dTd]�d]��Z�dU�dV��Z�dW�dX��Z
ff�dY�dZ��Zgf�d[da��Zd�a�d\dG��Zej7�d]�d^���Z�d_db��ZG�d`�da��da��ZG�db�dc��dc��Zej7�dd�de���ZdS(�z7Supporting definitions for the Python regression tests.ztest.supportz.support must be imported from the test package�N�)�get_test_runner�
PIPE_MAX_SIZE�verbose�
max_memuse�
use_resources�failfast�Error�
TestFailed�
TestDidNotRun�ResourceDenied�
import_module�import_fresh_module�CleanImport�unload�forget�record_original_stdout�get_original_stdout�captured_stdout�captured_stdin�captured_stderr�TESTFN�SAVEDCWD�unlink�rmtree�temp_cwd�findfile�create_empty_file�can_symlink�fs_is_case_insensitive�is_resource_enabled�requires�requires_freebsd_version�requires_linux_version�requires_mac_ver�requires_hashdigest�check_syntax_error�TransientResource�time_out�socket_peer_reset�ioerror_peer_reset�transient_internet�BasicTestRunner�run_unittest�run_doctest�skip_unless_symlink�
requires_gzip�requires_bz2�
requires_lzma�
bigmemtest�bigaddrspacetest�cpython_only�
get_attribute�requires_IEEE_754�skip_unless_xattr�
requires_zlib�anticipate_failure�load_package_tests�detect_api_mismatch�check__all__�requires_android_level�requires_multiprocessing_queue�	is_jython�
is_android�check_impl_detail�
unix_shell�setswitchinterval�HOST�IPV6_ENABLED�find_unused_port�	bind_port�open_urlresource�bind_unix_socket�
temp_umask�
reap_children�TestHandler�threading_setup�threading_cleanup�reap_threads�
start_threads�check_warnings�check_no_resource_warning�EnvironmentVarGuard�run_with_locale�	swap_item�	swap_attr�Matcher�set_memlimit�SuppressCrashReport�sortdict�run_with_tz�PGO�missing_compiler_executable�fd_countc@seZdZdZdS)r	z*Base class for regression test exceptions.N)�__name__�
__module__�__qualname__�__doc__�rdrd�-/usr/lib64/python3.6/test/support/__init__.pyr	|sc@seZdZdZdS)r
zTest failed.N)r`rarbrcrdrdrdrer
sc@seZdZdZdS)rzTest did not run any subtests.N)r`rarbrcrdrdrdrer�sc@seZdZdZdS)rz�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not be enabled.  It is used to distinguish between expected
    and unexpected skips.
    N)r`rarbrcrdrdrdrer�sTccs8|r.tj��tjddt�dVWdQRXndVdS)z�Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.
    �ignorez.+ (module|package)N)�warnings�catch_warnings�filterwarnings�DeprecationWarning)rfrdrdre�_ignore_deprecated_imports�s
rkF)�required_oncCsft|��Ty
tj|�Stk
rV}z&tjjt|��r8�tj	t
|���WYdd}~XnXWdQRXdS)acImport 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. If a module is required on a platform but optional for
    others, set required_on to an iterable of platform prefixes which will be
    compared against sys.platform.
    N)rk�	importlibr
�ImportError�sys�platform�
startswith�tuple�unittest�SkipTest�str)�name�
deprecatedrl�msgrdrdrer
�s	

cCs^|tjkrt|�tj|=x>ttj�D]0}||ks@|j|d�r&tj|||<tj|=q&WdS)zyHelper function to save and remove a module from sys.modules

    Raise ImportError if the module can't be imported.
    �.N)ro�modules�
__import__�listrq)rv�orig_modules�modnamerdrdre�_save_and_remove_module�s
rcCs>d}ytj|||<Wntk
r.d}YnXdtj|<|S)z�Helper function to save and block a module in sys.modules

    Return True if the module was in sys.modules, False otherwise.
    TFN)rorz�KeyError)rvr}Zsavedrdrdre�_save_and_block_module�s

r�cCs|r
tjSdd�S)z�Decorator to mark a test that is known to be broken in some cases

       Any use of this decorator should have a comment identifying the
       associated tracker issue.
    cSs|S)Nrd)�frdrdre�<lambda>�sz$anticipate_failure.<locals>.<lambda>)rsZexpectedFailure)Z	conditionrdrdrer:�scCsF|dkrd}tjjtjjtjjt���}|j|||d�}|j|�|S)z�Generic load_tests implementation for simple test packages.

    Most packages can implement load_tests using this function as follows:

       def load_tests(*args):
           return load_package_tests(os.path.dirname(__file__), *args)
    Nztest*)Z	start_dirZ
top_level_dir�pattern)�os�path�dirname�__file__ZdiscoverZaddTests)Zpkg_dir�loaderZstandard_testsr�Ztop_dirZ
package_testsrdrdrer;�s
cCs�t|���i}g}t||�zfyHx|D]}t||�q&Wx |D]}t||�s>|j|�q>Wtj|�}Wntk
r~d}YnXWdx|j�D]\}	}
|
tj	|	<q�Wx|D]}tj	|=q�WX|SQRXdS)a�Import and return a module, deliberately bypassing sys.modules.

    This function imports and returns a fresh copy of the named Python module
    by removing the named module from sys.modules before doing the import.
    Note that unlike reload, the original module is not affected by
    this operation.

    *fresh* is an iterable of additional module names that are also removed
    from the sys.modules cache before doing the import.

    *blocked* is an iterable of module names that are replaced with None
    in the module cache during the import to ensure that attempts to import
    them raise ImportError.

    The named module and any modules named in the *fresh* and *blocked*
    parameters are saved before starting the import and then reinserted into
    sys.modules when the fresh import is complete.

    Module and package deprecation messages are suppressed during this import
    if *deprecated* is True.

    This function will raise ImportError if the named module cannot be
    imported.
    N)
rkrr��appendrmr
rn�itemsrorz)rvZfreshZblockedrwr}Znames_to_removeZ
fresh_nameZblocked_nameZfresh_moduleZ	orig_name�moduleZname_to_removerdrdrer�s$





cCs>yt||�}Wn&tk
r4tjd||f��YnX|SdS)z?Get an attribute, raising SkipTest if AttributeError is raised.zobject %r has no attribute %rN)�getattr�AttributeErrorrsrt)�objrvZ	attributerdrdrer6s
cCs|adS)N)�_original_stdout)�stdoutrdrdrer0scCs
tptjS)N)r�ror�rdrdrdrer4scCs&ytj|=Wntk
r YnXdS)N)rorzr�)rvrdrdrer7scGsny||�Stk
rh}zDtdkrHtd|jj|f�td|j|f�tj|tj�||�Sd}~XnXdS)N�z%s: %szre-run %s%r)	�OSErrorr�print�	__class__r`r��chmod�stat�S_IRWXU)r��func�args�errrdrdre�
_force_run=sr��wincCs�||�|r|}ntjj|�\}}|p(d}d}x<|dkrjtj|�}|rJ|n||ksVdStj|�|d9}q0Wtjd|tdd�dS)Nryg����MbP?g�?r�z)tests may fail, delete still pending for �)�
stacklevel)	r�r��split�listdir�time�sleeprg�warn�RuntimeWarning)r��pathname�waitallr�rv�timeout�Lrdrdre�_waitforHs



r�cCsttj|�dS)N)r�r�r)�filenamerdrdre�_unlinkisr�cCsttj|�dS)N)r�r��rmdir)r�rdrdre�_rmdirlsr�cs,�fdd��t�|dd�tdd�|�dS)Ncs�x�t|tj|�D]�}tjj||�}ytj|�j}Wn<tk
rn}z td||ft	j
d�d}WYdd}~XnXtj|�r�t
�|dd�t|tj|�qt|tj|�qWdS)Nz-support.rmtree(): os.lstat(%r) failed with %s)�filerT)r�)r�r�r�r��join�lstat�st_moder�r�ro�
__stderr__r��S_ISDIRr�r�r)r�rv�fullname�mode�exc)�
_rmtree_innerrdrer�ps

z_rmtree.<locals>._rmtree_innerT)r�cSst|tj|�S)N)r�r�r�)�prdrdrer�sz_rmtree.<locals>.<lambda>)r�)r�rd)r�re�_rmtreeosr�c
Cs^yddl}Wntk
r Yn:X|jt|�d�}|jjj||t|��}|rZ|d|�S|S)Nrr�)�ctypesrnZcreate_unicode_buffer�len�windll�kernel32ZGetLongPathNameW)r�r��bufferZlengthrdrdre�	_longpath�s
r�csFytj|�dStk
r"YnX�fdd���|�tj|�dS)Nc
s�x~t|tj|�D]l}tjj||�}ytj|�j}Wntk
rJd}YnXtj	|�rn�|�t|tj
|�qt|tj|�qWdS)Nr)r�r�r�r�r�r�r�r�r�r�r�r)r�rvr�r�)r�rdrer��s

z_rmtree.<locals>._rmtree_inner)�shutilrr�r�r�)r�rd)r�rer��s
cCs|S)Nrd)r�rdrdrer��scCs*yt|�Wnttfk
r$YnXdS)N)r��FileNotFoundError�NotADirectoryError)r�rdrdrer�scCs&yt|�Wntk
r YnXdS)N)r�r�)r�rdrdrer��sr�cCs&yt|�Wntk
r YnXdS)N)r�r�)r�rdrdrer�scCsBtjj|�}tjjtjj|��}tjj||d�}tj||�|S)aMove a PEP 3147/488 pyc file to its legacy pyc location.

    :param source: The file system path to the source file.  The source file
        does not need to exist, however the PEP 3147/488 pyc file must exist.
    :return: The file system path to the legacy pyc file.
    �c)	rm�util�cache_from_sourcer�r�r��abspathr��rename)�sourceZpyc_fileZup_oneZ
legacy_pycrdrdre�make_legacy_pyc�s
r�cCs\t|�xNtjD]D}tjj||d�}t|d�x dD]}ttjj||d��q8WqWdS)	z�'Forget' a module was ever imported.

    This removes the module from sys.modules and deletes any PEP 3147/488 or
    legacy .pyc files.
    z.pyr��rr�)�optimizationN)r�rr�)	rror�r�r�rrmr�r�)r~r�r��optrdrdrer�s
cs�ttd�rtjSd}tjjd�r�ddl�ddl�d}d}G�fdd�d�j�}�j	j
}|j�}|sj�j��|�}�j
j�}|j||�j|��j|��j|��}|s��j��t|j|@�s�d}n�tjdk�rVdd	lm}	m�m}
m}dd
lm}|	j|d��}
|
j�dk�rd}nFG�fd
d�d|�}|�}|
|�}|
j|�dk�sR|
j|�dk�rVd}|�s�y.ddlm}|�}|j�|j �|j!�Wn\t"k
�r�}z>t#|�}t$|�dk�r�|dd�d}dj%t&|�j'|�}WYdd}~XnX|t_(|t_tjS)N�resultr�rrcs.eZdZd�jjfd�jjfd�jjfgZdS)z*_is_gui_available.<locals>.USEROBJECTFLAGSZfInheritZ	fReserved�dwFlagsN)r`rarb�wintypesZBOOL�DWORD�_fields_rd)r�rdre�USEROBJECTFLAGS�s

r�z,gui not available (WSF_VISIBLE flag not set)�darwin)�cdll�c_int�pointer�	Structure)�find_libraryZApplicationServicesz0gui tests cannot run without OS X window managercseZdZd�fd�fgZdS)z._is_gui_available.<locals>.ProcessSerialNumberZ
highLongOfPSNZlowLongOfPSNN)r`rarbr�rd)r�rdre�ProcessSerialNumbersr�z#cannot run without OS X gui process)�Tk�2z [...]zTk unavailable due to {}: {}))�hasattr�_is_gui_availabler�rorprqr�Zctypes.wintypesr�r�Zuser32ZGetProcessWindowStationZWinErrorr�r�ZGetUserObjectInformationWZbyrefZsizeof�boolr�r�r�r�Zctypes.utilr�ZLoadLibraryZCGMainDisplayIDZGetCurrentProcessZSetFrontProcessZtkinterr�Zwithdraw�updateZdestroy�	Exceptionrur��format�typer`�reason)r�Z	UOI_FLAGSZWSF_VISIBLEr�Zdll�hZuofZneeded�resr�r�r�r�Zapp_servicesr�ZpsnZpsn_pr��root�eZ
err_stringrd)r�r�rer��sh

r�cCstdkp|tkS)z�Test 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)r)�resourcerdrdrer $scCs>t|�s |dkrd|}t|��|dkr:t�r:ttj��dS)z@Raise ResourceDenied if the specified resource is not available.Nz"Use of the %r resource not enabled�gui)r rr�r�)r�rxrdrdrer!,scs��fdd�}|S)z�Decorator raising SkipTest if the OS is `sysname` and the version is less
    than `min_version`.

    For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
    the FreeBSD version is less than 7.2.
    cs$tj�����fdd��}�|_|S)Nc
s�tj��krztj�jdd�d}yttt|jd���}Wntk
rLYn.X|�krzdjtt	���}t
jd�||f���||�S)N�-rrryz(%s version %s or higher required, not %s)rp�system�releaser�rr�map�int�
ValueErrorr�rursrt)r��kw�version_txt�version�min_version_txt)r��min_version�sysnamerdre�wrapper=sz:_requires_unix_version.<locals>.decorator.<locals>.wrapper)�	functools�wrapsr�)r�r�)r�r�)r�re�	decorator<sz)_requires_unix_version.<locals>.decoratorrd)r�r�r�rd)r�r�re�_requires_unix_version5sr�cGs
td|�S)z�Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
    less than `min_version`.

    For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD
    version is less than 7.2.
    ZFreeBSD)r�)r�rdrdrer"PscGs
td|�S)z�Decorator raising SkipTest if the OS is Linux and the Linux version is
    less than `min_version`.

    For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux
    version is less than 2.6.32.
    ZLinux)r�)r�rdrdrer#Yscs�fdd�}|S)z�Decorator 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"tj����fdd��}�|_|S)Ncsxtjdkrntj�d}yttt|jd���}Wntk
rBYn,X|�krndjtt	���}t
jd||f���||�S)Nr�rryz&Mac OS X %s or higher required, not %s)rorpZmac_verrrr�r�r�r�r�rursrt)r�r�r�r�r�)r�r�rdrer�js
z4requires_mac_ver.<locals>.decorator.<locals>.wrapper)r�r�r�)r�r�)r�)r�rer�isz#requires_mac_ver.<locals>.decoratorrd)r�r�rd)r�rer$bscs��fdd�}|S)a�Decorator raising SkipTest if a hashing algorithm is not available

    The hashing algorithm could be missing or blocked by a strict crypto
    policy.

    If 'openssl' is True, then the decorator checks that OpenSSL provides
    the algorithm. Otherwise the check falls back to built-in
    implementations.

    ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
    ValueError: unsupported hash type md4
    cstj�����fdd��}|S)NcsXy&�rtdk	rtj��n
tj��Wn&tk
rLtjd��d���YnX�||�S)Nz
hash digest 'z' is not available.)�_hashlib�new�hashlibr�rsrt)r��kwargs)�
digestnamer��opensslrdrer��sz7requires_hashdigest.<locals>.decorator.<locals>.wrapper)r�r�)r�r�)rr)r�rer��sz&requires_hashdigest.<locals>.decoratorrd)rrr�rd)rrrer%}s
z	127.0.0.1z::1cCs"tj||�}t|�}|j�~|S)a�
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
    OSError 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.
    )�socketrH�close)�familyZsocktypeZtempsock�portrdrdrerG�s
8cCs�|jtjkr�|jtjkr�ttd�r>|jtjtj�dkr>t	d��ttd�r~y |jtjtj
�dkrft	d��Wntk
r|YnXttd�r�|jtjtj
d�|j|df�|j�d}|S)a%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.
    �SO_REUSEADDRrzHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!�SO_REUSEPORTzHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!�SO_EXCLUSIVEADDRUSEr)rr�AF_INETr��SOCK_STREAMr�Z
getsockoptZ
SOL_SOCKETrr
rr�Z
setsockoptr�bindZgetsockname)�sock�hostrrdrdrerH�s


cCsJ|jtjkst�y|j|�Wn&tk
rD|j�tjd��YnXdS)zBBind a unix socket, raising SkipTest if PermissionError is raised.zcannot bind AF_UNIX socketsN)	rrZAF_UNIX�AssertionErrorr�PermissionErrorrrsrt)rZaddrrdrdrerJscCsZtjrVd}z<y"tjtjtj�}|jtdf�dStk
rBYnXWd|rT|j�XdS)z+Check whether IPv6 is enabled on this host.NrTF)rZhas_ipv6ZAF_INET6r
r�HOSTv6r�r)rrdrdre�_is_ipv6_enableds

rcstj���fdd��}|S)z5Skip the test on TLS certificate validation failures.csNy�||�Wn:tk
rH}zdt|�kr6tjd���WYdd}~XnXdS)NZCERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)�IOErrorrursrt)r�r�r�)r�rdre�decs
z&system_must_validate_cert.<locals>.dec)r�r�)r�rrd)r�re�system_must_validate_certs	rr�i�ZdoubleZIEEEztest requires IEEE 754 doublesz
requires zlibz
requires gzipzrequires bz2z
requires lzma�java�ANDROID_API_LEVEL�win32z/system/bin/shz/bin/shz$testz@testz	{}_{}_tmp�æ�İ�Ł�φ�К�א�،�ت�ก� �€u-àòɘŁğr�ZNFD�ntr�u-共Ł♡ͣ�ztWARNING: The filename %r CAN be encoded by the filesystem encoding (%s). Unicode filename tests may not be effective��s-��surrogateescape��w����������r�ccs�d}|dkr&tj�}d}tjj|�}nBytj|�d}Wn.tk
rf|sN�tjd|t	dd�YnX|rttj
�}z
|VWd|r�|tj
�kr�t|�XdS)a�Return 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.

    FNTz+tests may fail, unable to create temp dir: �)r�)�tempfile�mkdtempr�r��realpath�mkdirr�rgr�r��getpidr)r��quietZdir_created�pidrdrdre�temp_dir�s&


r3ccsftj�}ytj|�Wn.tk
rD|s,�tjd|tdd�YnXztj�VWdtj|�XdS)agReturn 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.

    z)tests may fail, unable to change CWD to: r+)r�N)r��getcwd�chdirr�rgr�r�)r�r1Z	saved_dirrdrdre�
change_cwd	s

r6�tempcwdccs:t||d��$}t||d��}|VWdQRXWdQRXdS)a�
    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.

    )r�r1)r1N)r3r6)rvr1Z	temp_pathZcwd_dirrdrdrer$s�umaskccs&tj|�}z
dVWdtj|�XdS)z8Context manager that temporarily sets the process umask.N)r�r8)r8ZoldmaskrdrdrerK8s

�datacCsbtjj|�r|S|dk	r&tjj||�}tgtj}x*|D]"}tjj||�}tjj|�r8|Sq8W|S)a[Try to find a file on sys.path or in the test 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).

    Setting *subdir* indicates a relative path to use to find the file
    rather than looking directly in the path directories.
    N)r�r��isabsr��
TEST_HOME_DIRro�exists)r�Zsubdirr�Zdn�fnrdrdrerIs
cCs(tj|tjtjBtjB�}tj|�dS)z>Create an empty file. If the file already exists, truncate it.N)r��open�O_WRONLY�O_CREAT�O_TRUNCr)r��fdrdrdrer[scCs,t|j��}dd�|D�}dj|�}d|S)z%Like repr(dict), but in sorted order.cSsg|]}d|�qS)z%r: %rrd)�.0Zpairrdrdre�
<listcomp>cszsortdict.<locals>.<listcomp>z, z{%s})�sortedr�r�)�dictr�Z	reprpairsZ
withcommasrdrdrer[`s
cCs*ttd�}z|j�S|j�tt�XdS)z`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    �wbN)r>r�filenorr)r�rdrdre�make_bad_fdgs

rI)�lineno�offsetcCsp|jt��}t|dd�WdQRX|j}|j|j�|dk	rJ|j|j|�|j|j�|dk	rl|j|j|�dS)Nz
<test string>�exec)�assertRaises�SyntaxError�compileZ	exceptionZassertIsNotNonerJ�assertEqualrK)�testcaseZ	statementrJrK�cmr�rdrdrer&sscsVddl}ddl}�jdd��|jj|�djd�d}tjjt	|�}���fdd�}tjj
|�r|||�}|dk	rt|St|�td�t
r�td	|t�d
�|jj�}tr�|jjd�|j|d
d�}tr�|jjd�dkr�tj|d�}zBt|d��.}	|j�}
x|
�r|	j|
�|j�}
�q�WWdQRXWd|j�X||�}|dk	�rF|Std|��dS)Nr�checkr��/rcs>t|f����}�dkr|S�|�r2|jd�|S|j�dS)Nr)r>�seekr)r=r�)r�rSr�rdre�check_valid_file�s
z*open_urlresource.<locals>.check_valid_fileZurlfetchz	fetching %s ...)r��Accept-Encoding�gzip�)r�zContent-Encoding)ZfileobjrGzinvalid resource %r���)rWrX)Zurllib.requestZurllib.parse�pop�parseZurlparser�r�r�r��
TEST_DATA_DIRr<rr!rr�rZrequestZbuild_openerrXZ
addheadersr�r>Zheaders�getZGzipFile�read�writerr
)Zurlr�r��urllibr�r=rVr��opener�out�srd)r�rSr�rerI~s<	



c@s4eZdZdZdd�Zdd�Zedd��Zdd	�Zd
S)�WarningsRecorderzyConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS)Nr)�	_warnings�_last)�selfZ
warnings_listrdrdre�__init__�szWarningsRecorder.__init__cCsDt|j�|jkr t|jd|�S|tjjkr0dStd||f��dS)Nrz%r has no attribute %rrZ)r�rfrgr�rg�WarningMessage�_WARNING_DETAILSr�)rh�attrrdrdre�__getattr__�s
zWarningsRecorder.__getattr__cCs|j|jd�S)N)rfrg)rhrdrdrerg�szWarningsRecorder.warningscCst|j�|_dS)N)r�rfrg)rhrdrdre�reset�szWarningsRecorder.resetN)	r`rarbrcrirm�propertyrgrnrdrdrdrere�s
rec
cs
tjd�}|jjd�}|r"|j�tjdd�� }tjdjd�t	|�VWdQRXt
|�}g}xz|D]r\}}d}	xH|dd�D]8}|j}
tj
|t|
�tj�r�t|
j|�r�d}	|j|�q�W|	rf|rf|j||jf�qfW|r�td	|d
��|�rtd|d
��dS)z�Catch 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.
    r�Z__warningregistry__T)�recordrg�alwaysNFzunhandled warning %srz)filter (%r, %s) did not catch any warning)ro�	_getframe�	f_globalsr^�clearrgrhrz�simplefilterrer|�message�re�matchru�I�
issubclassr��remover�r`r)�filtersr1�frame�registry�wZreraiseZmissingrx�cat�seenZwarningrdrdre�_filterwarnings�s0
r�cOs.|jd�}|s$dtff}|dkr$d}t||�S)a�Context 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)
    r1r�NT)r^�Warningr�)r|r�r1rdrdrerR�s

r�ccsHtjdd��&}tjd||d�dV|r.t�WdQRX|j|g�dS)a�Context manager to check that no warnings are emitted.

    This context manager enables a given warning within its scope
    and checks that no warnings are emitted even with that warning
    enabled.

    If force_gc is True, a garbage collection is attempted before checking
    for warnings. This may help to catch warnings emitted when objects
    are deleted, such as ResourceWarning.

    Other keyword arguments are passed to warnings.filterwarnings().
    T)rprq)rv�categoryN)rgrhri�
gc_collectrP)rQrvr�Zforce_gc�warnsrdrdre�check_no_warningssr�ccsBtjdd�� }tjdtd�dVt�WdQRX|j|g�dS)a"Context manager to check that no ResourceWarning is emitted.

    Usage:

        with check_no_resource_warning(self):
            f = open(...)
            ...
            del f

    You must remove the object which may emit ResourceWarning before
    the end of the context manager.
    T)rprq)r�N)rgrhri�ResourceWarningr�rP)rQr�rdrdrerSs
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra,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
    cGsNtjj�|_x<|D]4}|tjkrtj|}|j|kr>tj|j=tj|=qWdS)N)rorz�copy�original_modulesr`)rhZmodule_namesZmodule_namer�rdrdreri?s




zCleanImport.__init__cCs|S)Nrd)rhrdrdre�	__enter__LszCleanImport.__enter__cGstjj|j�dS)N)rorzr�r�)rh�
ignore_excrdrdre�__exit__OszCleanImport.__exit__N)r`rarbrcrir�r�rdrdrdrer3s

c@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rTz_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS)N)r��environ�_environ�_changed)rhrdrdreriXszEnvironmentVarGuard.__init__cCs
|j|S)N)r�)rh�envvarrdrdre�__getitem__\szEnvironmentVarGuard.__getitem__cCs*||jkr|jj|�|j|<||j|<dS)N)r�r�r^)rhr��valuerdrdre�__setitem___s
zEnvironmentVarGuard.__setitem__cCs2||jkr|jj|�|j|<||jkr.|j|=dS)N)r�r�r^)rhr�rdrdre�__delitem__es

zEnvironmentVarGuard.__delitem__cCs
|jj�S)N)r��keys)rhrdrdrer�lszEnvironmentVarGuard.keyscCs
t|j�S)N)�iterr�)rhrdrdre�__iter__oszEnvironmentVarGuard.__iter__cCs
t|j�S)N)r�r�)rhrdrdre�__len__rszEnvironmentVarGuard.__len__cCs|||<dS)Nrd)rhr�r�rdrdre�setuszEnvironmentVarGuard.setcCs
||=dS)Nrd)rhr�rdrdre�unsetxszEnvironmentVarGuard.unsetcCs|S)Nrd)rhrdrdrer�{szEnvironmentVarGuard.__enter__cGsJx<|jj�D].\}}|dkr0||jkr:|j|=q||j|<qW|jt_dS)N)r�r�r�r�r�)rhr��k�vrdrdrer�~s

zEnvironmentVarGuard.__exit__N)r`rarbrcrir�r�r�r�r�r�r�r�r�r�rdrdrdrerTSsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
DirsOnSysPatha�Context 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(tjdd�|_tj|_tjj|�dS)N)ror��original_value�original_object�extend)rh�pathsrdrdreri�szDirsOnSysPath.__init__cCs|S)Nrd)rhrdrdrer��szDirsOnSysPath.__enter__cGs|jt_|jtjdd�<dS)N)r�ror�r�)rhr�rdrdrer��szDirsOnSysPath.__exit__N)r`rarbrcrir�r�rdrdrdrer��s
r�c@s*eZdZdZdd�Zdd�Zd	dd�ZdS)
r'z�Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS)N)r��attrs)rhr�r�rdrdreri�szTransientResource.__init__cCs|S)Nrd)rhrdrdrer��szTransientResource.__enter__NcCsT|dk	rPt|j|�rPx:|jj�D]$\}}t||�s4Pt||�|kr Pq Wtd��dS)z�If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).Nz%an optional resource is not available)rzr�r�r�r�r�r)rhZtype_r��	tracebackrlZ
attr_valuerdrdrer��s
zTransientResource.__exit__)NNN)r`rarbrcrir�r�rdrdrdrer'�s)�errnog>@)r��errnosc	#spd!d"d#d$d%d&g}d(d*d,d.d/g}td|��|�g��sRdd�|D��dd�|D�����fdd�}tj�}z�y|dk	r�tj|�dVWn�tjk
�r�}z&tr�tjj	�j
dd��|�WYdd}~Xn�tk
�rZ}zpx^|j
}t|�d k�rt
|dt��r|d}n*t|�dk�r8t
|d t��r8|d }nP�q�W||��WYdd}~XnXWdtj|�XdS)0z�Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.�ECONNREFUSED�o�
ECONNRESET�h�EHOSTUNREACH�q�ENETUNREACH�e�	ETIMEDOUT�n�
EADDRNOTAVAIL�c�	EAI_AGAINr+�EAI_FAILr��
EAI_NONAMEr��
EAI_NODATA��
WSANO_DATA�*zResource %r is not availablecSsg|]\}}tt||��qSrd)r�r�)rCrv�numrdrdrerD�sz&transient_internet.<locals>.<listcomp>cSsg|]\}}tt||��qSrd)r�r)rCrvr�rdrdrerD�scs�t|dd�}t|tj�s�t|tj�r,|�ks�t|tjj�rTd|jkoNdkns�t|tjj	�r�d|j
ks�d|j
ks�d|j
ks�|�kr�ts�tj
j�jdd��|�dS)	Nr�i�iW�ConnectionRefusedError�TimeoutError�EOFErrorr�
)r��
isinstancerr�Zgaierrorra�errorZ	HTTPError�codeZURLErrorr�rro�stderrr`r�)r��n)�captured_errnos�denied�
gai_errnosrdre�filter_error�s


z(transient_internet.<locals>.filter_errorNrr�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r����)r�r����)r�r����)r�r����)r�r�)r�r�)rrZgetdefaulttimeoutZsetdefaulttimeout�nntplibZNNTPTemporaryErrorrror�r`r�r�r�r�)	Z
resource_namer�r�Zdefault_errnosZdefault_gai_errnosr�Zold_timeoutr��ard)r�r�r�rer+�sP



c
csFddl}tt|�}tt||j��ztt|�VWdtt||�XdS)z�Return a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.rN)�ior�ro�setattr�StringIO)Zstream_namer�Zorig_stdoutrdrdre�captured_outputs
r�cCstd�S)z�Capture the output of sys.stdout:

       with captured_stdout() as stdout:
           print("hello")
       self.assertEqual(stdout.getvalue(), "hello\n")
    r�)r�rdrdrdrerscCstd�S)z�Capture the output of sys.stderr:

       with captured_stderr() as stderr:
           print("hello", file=sys.stderr)
       self.assertEqual(stderr.getvalue(), "hello\n")
    r�)r�rdrdrdrer%scCstd�S)a	Capture the input to sys.stdin:

       with captured_stdin() as stdin:
           stdin.write('hello\n')
           stdin.seek(0)
           # call test code that consumes from sys.stdin
           captured = input()
       self.assertEqual(captured, "hello")
    �stdin)r�rdrdrdrer.s
cCs*tj�trtjd�tj�tj�dS)a�Force 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)�gcZcollectr@r�r�rdrdrdrer�;s


r�c
cs.tj�}tj�z
dVWd|r(tj�XdS)N)r��	isenabled�disable�enable)Zhave_gcrdrdre�
disable_gcKs
r�cCs:tjd�pd}d}x|j�D]}|jd�r|}qW|dkS)z,Find if Python was built with optimizations.�	PY_CFLAGSr�z-O�-O0�-Og)r�r�r�)�	sysconfig�get_config_varr�rq)ZcflagsZ	final_optr�rdrdre�python_is_optimizedVs
r�ZnPZ0n�gettotalrefcountZ2PZ0Pr�cCstjt|t�S)N)�struct�calcsize�_header�_align)�fmtrdrdre�calcobjsizegsr�cCstjt|t�S)N)r�r��_vheaderr�)r�rdrdre�calcvobjsizejsr���	cCspddl}tj|�}t|�tkr(|jt@sBt|�tkrLt|�jt@rL||j7}dt|�||f}|j|||�dS)Nrz&wrong size for %s: got %d, expected %d)	�	_testcapiro�	getsizeofr��	__flags__�_TPFLAGS_HEAPTYPE�_TPFLAGS_HAVE_GCZSIZEOF_PYGC_HEADrP)�test�o�sizer�r�rxrdrdre�check_sizeofqs

r�cs��fdd�}|S)Ncs$���fdd�}�j|_�j|_|S)Ncs�y ddl}t|��}|j|�}Wn(tk
r6�YnBd}}Yn0Xx,�D]$}y|j||�PWqPYqPXqPWz
�||�S|r�|r�|j||�XdS)Nr)�localer��	setlocaler�)r��kwdsr�r�Zorig_locale�loc)�catstrr��localesrdre�inner�s$



z1run_with_locale.<locals>.decorator.<locals>.inner)r`rc)r�r�)r�r�)r�rer��sz"run_with_locale.<locals>.decoratorrd)r�r�r�rd)r�r�rerU�scs�fdd�}|S)Ncs"��fdd�}�j|_�j|_|S)Ncs�y
tj}Wntk
r(tjd��YnXdtjkr@tjd}nd}�tjd<|�z
�||�S|dkrrtjd=n
|tjd<tj�XdS)Nztzset requiredZTZ)r��tzsetr�rsrtr�r�)r�r�r�Zorig_tz)r��tzrdrer��s





z-run_with_tz.<locals>.decorator.<locals>.inner)r`rc)r�r�)r�)r�rer��szrun_with_tz.<locals>.decoratorrd)r�r�rd)r�rer\�scCs�dttdtd�}tjd|tjtjB�}|dkr>td|f��tt|j	d��||j	d�j
��}|a|tkrrt}|t
dkr�td|f��|adS)Ni)r��m�g�tz(\d+(\.\d+)?) (K|M|G|T)b?$zInvalid memory limit %rrr+z$Memory limit %r too low to be useful)�_1M�_1Grwrx�
IGNORECASE�VERBOSEr�r��float�group�lower�real_max_memuse�MAX_Py_ssize_t�_2Gr)�limitZsizesr�ZmemlimitrdrdrerY�s$c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_MemoryWatchdogz`An object which periodically watches the process' memory consumption
    and prints it out.
    cCsdjtj�d�|_d|_dS)Nz/proc/{pid}/statm)r2F)r�r�r0�procfile�started)rhrdrdreri�sz_MemoryWatchdog.__init__cCs�yt|jd�}Wn<tk
rL}z tjdj|�t�tjj	�dSd}~XnXt
d�}tjtj
|g|tjd�|_|j�d|_dS)N�rz!/proc not available for stats: {}zmemory_watchdog.py)r�r�T)r>r
r�rgr�r�r�ror��flushr�
subprocess�Popen�
executableZDEVNULL�mem_watchdogrr)rhr�r�Zwatchdog_scriptrdrdre�start�s
z_MemoryWatchdog.startcCs|jr|jj�|jj�dS)N)rrZ	terminate�wait)rhrdrdre�stop�s
z_MemoryWatchdog.stopN)r`rarbrcrirrrdrdrdrer	�sr	cs���fdd�}|S)atDecorator for bigmem tests.

    'size' is a requested size for the test (in arbitrary, test-interpreted
    units.) 'memuse' is the number of bytes per unit for the test, or a good
    estimate of it. For example, a test that needs two byte buffers, of 4 GiB
    each, could be decorated with @bigmemtest(size=_4G, memuse=2).

    The 'size' argument is normally passed to the decorated test method as an
    extra argument. If 'dry_run' is true, the value passed to the test method
    may be less than the requested value. If 'dry_run' is false, it means the
    test doesn't support dummy runs when -M is not specified.
    cs ���fdd����_��_�S)Nc
s��j}�j}tsd}n|}ts$�rFt||krFtjd||d��tr|tr|t�tdj||dd��t�}|j	�nd}z
�||�S|r�|j
�XdS)	Niz'not enough memory: %.1fG minimum neededir+z* ... expected peak memory use: {peak:.1f}G)Zpeaki@i@)r��memuserrsrtrr�r�r	rr)rhr�r�maxsizeZwatchdog)�dry_runr�r�rdrer�s*


z.bigmemtest.<locals>.decorator.<locals>.wrapper)r�r)r�)rrr�)r�r�rer�szbigmemtest.<locals>.decoratorrd)r�rrr�rd)rrr�rer3s
!cs�fdd�}|S)z0Decorator for tests that fill the address space.csDttkr8td
kr$tdkr$tjd��q@tjdtd��n�|�SdS)
Nr��?r�z-not enough memory: try a 32-bit build insteadz'not enough memory: %.1fG minimum neededir+ll����li@)rrrsrt)rh)r�rdrer�3sz!bigaddrspacetest.<locals>.wrapperrd)r�r�rd)r�rer41sc@seZdZdd�ZdS)r,cCstj�}||�|S)N)rsZ
TestResult)rhr�r�rdrdre�runDszBasicTestRunner.runN)r`rarbrrdrdrdrer,CscCs|S)Nrd)r�rdrdre�_idIsrcCs<|dkrt�rtjtj�St|�r(tStjdj|��SdS)Nr�zresource {0!r} is not enabled)r�rs�skipr�r rr�)r�rdrdre�requires_resourceLs
rcCs&trt|krtjd|tf�StSdS)Nz%s at Android API level %d)rA�_ANDROID_API_LEVELrsrr)�levelr�rdrdrer>TscCstdd�|�S)z9
    Decorator for tests only applicable on CPython.
    T)�cpython)�impl_detail)r�rdrdrer5[scKsVtf|�rtS|dkrLt|�\}}|r,d}nd}t|j��}|jdj|��}tj|�S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or )	rBr�
_parse_guardsrEr�r�r�rsr)rx�guardsZ
guardnames�defaultrdrdrer!as
r!cCsTtdkr:ddl}y|j�daWntk
r8daYnXd}trF|Stj|�|�S)z8Skip decorator for tests that use multiprocessing.Queue.NrTFz6requires a functioning shared semaphore implementation)�_have_mp_queue�multiprocessingZQueuernrsr)r�r&rxrdrdrer?os
cCsH|sddidfSt|j��d}t|j��|gt|�ks>t�||fS)Nr TFr)r|�valuesr�r)r#Zis_truerdrdrer"~s
r"cKs t|�\}}|jtj�j�|�S)a5This 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"r^rpZpython_implementationr)r#r$rdrdrerB�scs,ttd�s�Stj���fdd��}|SdS)zEDecorator to temporarily turn off tracing for the duration of a test.�gettracecs.tj�}ztjd��||�Stj|�XdS)N)ror(�settrace)r�r�Zoriginal_trace)r�rdrer��s


zno_tracing.<locals>.wrapperN)r�ror�r�)r�r�rd)r�re�
no_tracing�s
r*cCstt|��S)aDecorator for tests which involve reference counting.

    To start, the decorator does not run the test if is not run by CPython.
    After that, any trace function is unset during the test to prevent
    unexpected refcounts caused by the trace function.

    )r*r5)r�rdrdre�
refcount_test�sr+cCsRg}xB|jD]8}t|tj�r2t||�|j|�q||�r|j|�qW||_dS)z>Recursively filter test cases in a suite based on a predicate.N)Z_testsr�rs�	TestSuite�
_filter_suiter�)�suiteZpredZnewtestsr�rdrdrer-�s
r-cCs�ttjttdk	d�}|j|�}tdk	r4tj|j��|js>t	�|j
�s�t|j�dkrl|j
rl|jdd}n6t|j
�dkr�|jr�|j
dd}nd}ts�|d7}t|��dS)z2Run tests from a unittest.TestSuite-derived class.N)�	verbosityZcapture_outputrrzmultiple errors occurredz!; run in verbose mode for details)rror�r�junit_xml_listrr�Zget_xml_elementZtestsRunrZ
wasSuccessfulr��errorsZfailuresr
)r.Zrunnerr�r�rdrdre�
_run_suite�s"
r2cCstdkrdSt|j��SdS)NT)�_match_test_func�id)r�rdrdre�
match_test�sr5cCsd|kotjd|�S)Nryz[?*\[\]])rw�search)r�rdrdre�_is_full_match_test�sr7csr|tkrdS|sd}f}nHttt|��r4t|�j}n.djttj|��}t	j
|�j��fdd�}|}t|�a|a
dS)N�|cs$�|�rdStt�|jd���SdS)NTry)�anyr�r�)Ztest_id)�regex_matchrdre�match_test_regex�sz)set_match_tests.<locals>.match_test_regex)�_match_test_patterns�allr�r7r��__contains__r��fnmatch�	translaterwrOrxrrr3)Zpatternsr�Zregexr;rd)r:re�set_match_tests�srAcGs�tjtjf}tj�}xh|D]`}t|t�rT|tjkrJ|jtjtj|��qzt	d��qt||�rj|j|�q|jtj
|��qWt|t�t
|�dS)z1Run tests from unittest.TestCase-derived classes.z)str arguments must be keys in sys.modulesN)rsr,ZTestCaser�rurorzZaddTestZ
findTestCasesr�Z	makeSuiter-r5r2)�classesZvalid_typesr.�clsrdrdrer-s





cCsdS)z,Just used to check if docstrings are enabledNrdrdrdrdre�_check_docstrings(srD�WITH_DOC_STRINGSztest requires docstringscCs`ddl}|dkrt}nd}|j|||d�\}}|rBtd||f��trXtd|j|f�||fS)aRun doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    rN)r�optionflagsz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctestrZtestmodr
r�r`)r�r/rFrGr�r�rdrdrer.9scCstjj�fS)N)rorzr�rdrdrdre�
modules_setupTsrHcCs:dd�tjj�D�}tjj�tjj|�tjj|�dS)NcSs"g|]\}}|jd�r||f�qS)z
encodings.)rq)rCr�r�rdrdrerD[sz#modules_cleanup.<locals>.<listcomp>)rorzr�rtr�)Z
oldmodulesZ	encodingsrdrdre�modules_cleanupWs
rIcCs"trtj�tjj�fSdffSdS)Nr)�_thread�_count�	threading�	_danglingr�rdrdrdrerNzscGsJtsdSd}x8t|�D],}tj�tjf}||kr2Ptjd�t�qWdS)N�dg{�G�z�?)rJ�rangerKrLrMr�r�r�)Zoriginal_valuesZ
_MAX_COUNT�countr'rdrdrerO�s
cs"ts�Stj���fdd��}|S)z�Use 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.
    cst�}z�|�St|�XdS)N)rNrO)r��key)r�rdrer��szreap_threads.<locals>.decorator)rJr�r�)r�r�rd)r�rerP�s�N@ccs�tj�}z
dVWdtj�}||}xjtj�}||kr8Ptj�|kr|tj�|}d||�d|d�d|�d|�d�	}t|��tjd�t�q&WXdS)	aH
    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.
    Nz!wait_threads() failed to cleanup z threads after z.1fz seconds (count: z
, old count: �)g{�G�z�?)rJrKr�Z	monotonicrr�r�)r�Z	old_countZ
start_timeZdeadlinerPZdtrxrdrdre�wait_threads_exit�s
$
rTc
CsZttd�rVd}xFy2tj|tj�\}}|dkr.Ptd|tjd�WqPYqXqWdS)z�Use 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.
    �waitpidrrz2Warning -- reap_children() reaped child process %s)r�NrZ)r�r�rU�WNOHANGr�ror�)Zany_processr2ZstatusrdrdrerL�s
ccs*t|�}g}zZy$x|D]}|j�|j|�qWWn*trVtdt|�t|�f��YnXdVWdz�|rt|�tj�}}xltdd�D]^}|d7}x$|D]}|jt	|tj�d��q�Wdd�|D�}|s�Ptr�tdt|�|f�q�WWdd	d�|D�}|�r"t
jtj
�td
t|���XXdS)Nz/Can't start %d threads, only %d threads startedrr�<g{�G�z�?cSsg|]}|j�r|�qSrd)�isAlive)rCr�rdrdrerD�sz!start_threads.<locals>.<listcomp>z7Unable to join %d threads during a period of %d minutescSsg|]}|j�r|�qSrd)rX)rCr�rdrdrerD�szUnable to join %d threads)r|rr�rr�r�r�rOr��max�faulthandlerZdump_tracebackror�r)ZthreadsZunlockrr�ZendtimeZ	starttimer�rdrdrerQ�s>


c
csnt||�r<t||�}t|||�z
|VWdt|||�Xn.t|||�z
dVWdt||�rht||�XdS)a�Temporary 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)r�r�r��delattr)r�rl�new_val�real_valrdrdrerW�s




ccsX||kr0||}|||<z
|VWd|||<Xn$|||<z
dVWd||krR||=XdS)a�Temporary 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.
    Nrd)r��itemr\r]rdrdrerV	s

cCstjdd|�j�}|S)z�Strip 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, \d+ blocks\]\r?\n?�)rw�sub�strip)r�rdrdre�strip_python_stderr8	srbZ	getcountsz-types are immortal if COUNT_ALLOCS is definedcCstj�S)znReturn a list of command-line arguments reproducing the current
    settings in sys.flags and sys.warnoptions.)rZ_args_from_interpreter_flagsrdrdrdre�args_from_interpreter_flagsE	srccCstj�S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.)rZ"_optim_args_from_interpreter_flagsrdrdrdre�!optim_args_from_interpreter_flagsJ	srdc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rMcCstjjj|d�||_dS)Nr)�logging�handlers�BufferingHandlerri�matcher)rhrhrdrdreriT	szTestHandler.__init__cCsdS)NFrd)rhrdrdre�shouldFlush]	szTestHandler.shouldFlushcCs|j|�|jj|j�dS)N)r�r�r��__dict__)rhrprdrdre�emit`	s
zTestHandler.emitcKs.d}x$|jD]}|jj|f|�rd}PqW|S)zW
        Look for a saved dict whose keys/values match the supplied arguments.
        FT)r�rh�matches)rhr�r��drdrdrerld	szTestHandler.matchesN)r`rarbririrkrlrdrdrdrerMS	s	c@s eZdZdZdd�Zdd�ZdS)	rXrxrvcKs<d}x2|D]*}||}|j|�}|j|||�s
d}Pq
W|S)a.
        Try to match a single dict with the supplied arguments.

        Keys whose values are strings and which are in self._partial_matches
        will be checked for partial (i.e. substring) matches. You can extend
        this scheme to (for example) do regular expression matching, etc.
        TF)r^�match_value)rhrmr�r�r�r��dvrdrdrerls	s

zMatcher.matchescCsHt|�t|�krd}n.t|�tk	s,||jkr6||k}n|j|�dk}|S)zT
        Try to match a single stored value (dv) with a supplied value (v).
        Fr)r�ru�_partial_matches�find)rhr�ror�r�rdrdrern�	s
zMatcher.match_valueN)rxrv)r`rarbrprlrnrdrdrdrerXo	sc
CsZtdk	rtStd}ytjt|�d}Wntttfk
rFd}YnXtj|�|a|S)NrTF)�_can_symlinkrr��symlinkr��NotImplementedErrorr�r{)Zsymlink_path�canrdrdrer�	s

cCs t�}d}|r|Stj|�|�S)z8Skip decorator for tests that require functional symlinkz*Requires functional symlink implementation)rrsr)r��okrxrdrdrer/�	scCs�tdk	rtSttd�sd}n�tj�}tj|d�\}}z�ttd���}y`tj|dd�tj|dd�tj|j	�dd�t
j�}tj
d	|�}|dkp�t|jd
��dk}Wntk
r�d}YnXWdQRXWdtt�t|�t|�X|a|S)N�setxattrF)�dirrGs	user.testr_strusted.foos42z
2.6.(\d{1,2})r�')�
_can_xattrr�r�r,r-Zmkstempr>rrwrHrpr�rwrxr�rr�rr�)ruZtmp_dirZtmp_fpZtmp_name�fpZkernel_versionr�rdrdre�	can_xattr�	s,

r|cCs t�}d}|r|Stj|�|�S)zDSkip decorator for tests that require functional extended attributesz(no non-broken extended attribute support)r|rsr)r�rvrxrdrdrer8�	scCs$tpt}d}|r|Stj|�|�S)z;Skip decorator for tests not run in (non-extended) PGO taskz#Not run for (non-extended) PGO task)r]�PGO_EXTENDEDrsr)r�rvrxrdrdre�skip_if_pgo_task�	s
r~cCs^tj|d��H}|j}|j�}||kr,|j�}ytjj||�Stk
rNdSXWdQRXdS)zKDetects if the file system for the specified directory is case-insensitive.)rxFN)	r,ZNamedTemporaryFilerv�upperrr�r��samefiler�)Z	directory�base�	base_pathZ	case_pathrdrdrer�	s)rfcCs>tt|��tt|��}|r(|t|�8}tdd�|D��}|S)aReturns the set of items in ref_api not in other_api, except for a
    defined list of items to be ignored in this check.

    By default this skips private attributes beginning with '_' but
    includes all magic methods, i.e. those starting and ending in '__'.
    css(|] }|jd�s|jd�r|VqdS)�_�__N)rq�endswith)rCr�rdrdre�	<genexpr>�	sz&detect_api_mismatch.<locals>.<genexpr>)r�rx)Zref_apiZ	other_apirfZ
missing_itemsrdrdrer<�	s
cCs�|dkr|jf}nt|t�r"|f}t|�}xbt|�D]V}|jd�s4||krLq4t||�}t|dd�|ks�t|d�r4t|tj	�r4|j
|�q4W|j|j|�dS)aAssert that the __all__ variable of 'module' contains all public names.

    The module's public names (its API) are detected automatically based on
    whether they match the public name convention and were defined in
    'module'.

    The 'name_of_module' argument can specify (as a string or tuple thereof)
    what module(s) an API could be defined in in order to be detected as a
    public API. One case for this is when 'module' imports part of its public
    API from other modules, possibly a C backend (like 'csv' and its '_csv').

    The 'extra' argument can be a set of names that wouldn't otherwise be
    automatically detected as "public", like objects without a proper
    '__module__' attribute. If provided, it will be added to the
    automatically detected ones.

    The 'blacklist' argument can be a set of names that must not be treated
    as part of the public API even though their names indicate otherwise.

    Usage:
        import bar
        import foo
        import unittest
        from test import support

        class MiscTestCase(unittest.TestCase):
            def test__all__(self):
                support.check__all__(self, foo)

        class OtherTestCase(unittest.TestCase):
            def test__all__(self):
                extra = {'BAR_CONST', 'FOO_CONST'}
                blacklist = {'baz'}  # Undocumented name.
                # bar imports part of its API from _bar.
                support.check__all__(self, bar, ('bar', '_bar'),
                                     extra=extra, blacklist=blacklist)

    Nr�ra)
r`r�rur�rxrqr�r��types�
ModuleType�addZassertCountEqual�__all__)Z	test_caser�Zname_of_moduleZextraZ	blacklistZexpectedrvr�rdrdrer=�	s)


c@s(eZdZdZdZdZdd�Zdd�ZdS)rZz�Try 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.
    Nc
Csrtjjd�r�ddl}|jj|_d}|jj|�|_|jj|j|B�yddl	}|j
Wnttfk
rlYnLXi|_
x�|j|j|jgD].}|j
||j�}|j||j�}||f|j
|<q�Wn�tdk	�r
y*tjtj�|_tjtjd|jdf�Wnttfk
�rYnXtjdk�rnddd	d
g}tj|tjtjd�}|�|j�d}	WdQRX|	j�dk�rntd
ddd�|S)z�On 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�rNr�rr�z/usr/bin/defaultsr_zcom.apple.CrashReporterZ
DialogType)r�r�s	developerz:this test triggers the Crash Reporter, that is intentionalr�T)�endr
) rorprqr�r�r��_k32�SetErrorMode�	old_value�msvcrt�CrtSetReportModer�rn�	old_modes�CRT_WARN�	CRT_ERROR�
CRT_ASSERTZCRTDBG_MODE_FILE�CrtSetReportFileZCRTDBG_FILE_STDERRr�Z	getrlimit�RLIMIT_CORE�	setrlimitr�r�rr�PIPEZcommunicaterar�)
rhr�ZSEM_NOGPFAULTERRORBOXr��report_type�old_mode�old_file�cmd�procr�rdrdrer�2
sN




zSuppressCrashReport.__enter__cGs�|jdkrdStjjd�rl|jj|j�|jr�ddl}xj|jj�D]$\}\}}|j	||�|j
||�qBWn6tdk	r�ytjtj
|j�Wnttfk
r�YnXdS)zARestore Windows ErrorMode or core file behavior to initial value.Nr�r)r�rorprqr�r�r�r�r�r�r�r�r�r�r�r�)rhr�r�r�r�r�rdrdrer�s
s
zSuppressCrashReport.__exit__)r`rarbrcr�r�r�r�rdrdrdrerZ)
s
Acsrt���d�y�j��Wn$ttfk
r@t��d��YnXd�����fdd�}|j|�t��|�dS)z�Override 'object_to_patch'.'attr_name' with 'new_value'.

    Also, add a cleanup procedure to 'test_instance' to restore
    'object_to_patch' value for 'attr_name'.
    The 'attr_name' should be a valid attribute for 'object_to_patch'.

    FNTcs �rt����n
t���dS)N)r�r[rd)�
attr_is_local�	attr_name�object_to_patchr�rdre�cleanup�
szpatch.<locals>.cleanup)r�rjr�r�Z
addCleanupr�)Z
test_instancer�r�Z	new_valuer�rd)r�r�r�r�re�patch�
s


r�cCsFyddl}Wntk
r YnX|j�r4tjd��ddl}|j|�S)zi
    Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc
    module is enabled.
    rNzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations)�tracemallocrnZ
is_tracingrsrtr��run_in_subinterp)r�r�r�rdrdrer��
s
r�csHG��fdd�d|�}d�|||���|jtt��t�|j��dS)NcseZdZ��fdd�ZdS)z%check_free_after_iterating.<locals>.Acs*d�yt��Wntk
r$YnXdS)NT)�next�
StopIteration)rh)�done�itrdre�__del__�
s
z-check_free_after_iterating.<locals>.A.__del__N)r`rarbr�rd)r�r�rdre�A�
sr�F)rMr�r�r�Z
assertTrue)r�r�rCr�r�rd)r�r�re�check_free_after_iterating�
s	r�cCs�ddlm}m}m}|j�}|j|�xd|jD]Z}|r@||kr@q.t||�}|rd|dk	sntd|��n
|dkrnq.|j	|d�dkr.|dSq.WdS)a<Check if the compiler components used to build the interpreter exist.

    Check for the existence of the compiler executables whose names are listed
    in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
    and return the first missing executable or None when none is found
    missing.

    r)�	ccompilerr��spawnNz%the '%s' executable is not configured)
Z	distutilsr�r�r�Znew_compilerZcustomize_compilerZexecutablesr�rZfind_executable)Z	cmd_namesr�r�r�Zcompilerrvr�rdrdrer^�
s	


cCs@d}tr6||kr6tdkr.tjddg�j�dkatr6|}tj|�S)Ng�h㈵��>Zgetpropzro.kernel.qemu�1)rA�_is_android_emulatorrZcheck_outputrarorD)ZintervalZminimum_intervalrdrdrerD�
sc
cs>tjj�}tj�}ztj�dVWd|r8tj|dd�XdS)NT)r�Zall_threads)ror�rHrZ�
is_enabledr�r�)rBr�rdrdre�disable_faulthandler�
s

r�c	/Cs�tjjd�r8ytjd�}t|�dStk
r6YnXd}ttd�rjytjd�}Wnt	k
rhYnXd}tjd	kr�yd
dl
}|jWntt
fk
r�Yn0Xi}x(|j|j|jfD]}|j|d
�||<q�Wzpd
}xft|�D]Z}ytj|�}Wn4t	k
�r(}z|jtjk�r�WYdd}~Xq�Xtj|�|d7}q�WWd|dk	�rzx*|j|j|jfD]}|j|||��q`WX|S)z/Count the number of open file descriptors.
    �linux�freebsdz
/proc/self/fdr��sysconf�SC_OPEN_MAXNrr)r�r�)rorprqr�r�r�r�r�r�r�r�r�r�rnr�r�r�rO�dupr�ZEBADFr)	�namesZMAXFDr�r�r�rPrBZfd2r�rdrdrer_	sP





c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SaveSignalsz�
    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.
    cCsjddl}||_ttd|j��|_x>dD]6}yt||�}Wntk
rNw&YnX|jj|�q&Wi|_dS)Nrr�SIGKILL�SIGSTOP)r�r�)	�signalr|rO�NSIG�signalsr�r�r{rf)rhr�Zsigname�signumrdrdreriMs
zSaveSignals.__init__cCs4x.|jD]$}|jj|�}|dkr"q||j|<qWdS)N)r�r��	getsignalrf)rhr��handlerrdrdre�saveZs
zSaveSignals.savecCs*x$|jj�D]\}}|jj||�qWdS)N)rfr�r�)rhr�r�rdrdre�restorefszSaveSignals.restoreN)r`rarbrcrir�r�rdrdrdrer�Ds
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�FakePathz.Simple implementing of the path protocol.
    cCs
||_dS)N)r�)rhr�rdrdrerinszFakePath.__init__cCsd|j�d�S)Nz
<FakePath �>)r�)rhrdrdre�__repr__qszFakePath.__repr__cCs6t|jt�s$t|jt�r,t|jt�r,|j�n|jSdS)N)r�r��
BaseExceptionr�rz)rhrdrdre�
__fspath__ts
zFakePath.__fspath__N)r`rarbrcrir�r�rdrdrdrer�ksr�ccs.tj�}ztj|�dVWdtj|�XdS)z>Temporarily change the integer string conversion length limit.N)ro�get_int_max_str_digits�set_int_max_str_digits)Z
max_digitsZcurrentrdrdre�adjust_int_max_str_digits|s


r�)T)F)F)N)Nii@i@i@ii)rrrrrrrr r!r"r#)r'r%r(r)r*)NF)F)r7F)N)Fi@ii)T)N)Nr)rR)N(rcr`rn�collections.abc�collections�
contextlibZdatetimer�rZr?r�r�r�rm�importlib.utilr�Zlogging.handlersrer�r�rprwr�rr�r�rror�r,r�r�rsZurllib.errorrargZ
testresultrrJrLZmultiprocessing.processr&�zlibrX�bz2Zlzmar�r�r�r�r	r
rrtr�contextmanagerrkr
rr�r:r;rr6rrrrr0rr�rrrr�rqr�r�r�r�r�rr�rr�rr�r r!r�r"r#r$r%rErr	r
rGrHrJrrFrrZ
SOCK_MAX_SIZEZ
skipUnlessr�
__getformat__r7r9r0r1r2r@r�rrArCrvrr�r0ZFS_NONASCII�	character�fsdecode�fsencode�UnicodeErrorZTESTFN_UNICODEZunicodedataZ	normalize�getfilesystemencodingZTESTFN_ENCODINGZTESTFN_UNENCODABLEZgetwindowsversion�encode�UnicodeEncodeErrorr��decode�UnicodeDecodeErrorZTESTFN_UNDECODABLEZTESTFN_NONASCIIr4rr]r}r3r6rr�rKr�r�r�r�ZTEST_SUPPORT_DIRr;r�r]rrr[rIr&rI�objectrer�rRr�r�rSr�abc�MutableMappingrTr�r'r�r�r(r�r)r*r+r�rrrr�r�r�r�r�r�r�r�r�r�r�rUr\r�r�rZ_4GrrrYr	r3r4r,rrr>r5r!r%r?r"rBr*r+r-r2r3r<r5r7rAr-rDZMISSING_C_DOCSTRINGSZHAVE_DOCSTRINGSZrequires_docstringsr.rHrIZenvironment_alteredrNrOrPrTrLrQrWrVrbZskipIfZrequires_type_collectingrcrdrfrgrMrXrrrr/rzr|r8r~rr<r=rZr�r�r�r^r�rDr�r_r�r�r�rdrdrdre�<module>s�











2	
!

J			>%	


%2' 5M		



$
#
0







(




"
#
	"
:_";'

Zerion Mini Shell 1.0