Your IP : 216.73.216.196


Current Path : /opt/alt/python27/lib/python2.7/site-packages/_pytest/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyc

�
�mYc
@`s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZyddlZWne
k
r�dZnXejd0kZeZed�Ze�Zejd d1kZejd d2kZer�dnd	Zeed
�rd�Zn	d�ZejZejZeed
d��Zeejd��Z d�Z!d�Z"d�Z#d�Z$dd�Z%ejd d3kr�d�Zner�ddl&Z&e'Z(e)e*fZ+d�Z,n(e)e*e-fZ+ddl.m(Z(d�Z,d�Z/d�Z0d�Z1d�Z2d�Z3erId�Z4n	d�Z4d4Z5d*�Z6erzdd+l7m8Z9n%ddl:Z:d,e:j;fd-��YZ9d.efd/��YZ<dS(5s#
python version compatibility code
i(tabsolute_importtdivisiontprint_functionNiiiitModuleNotFoundErrortImportErrort	signaturecC`sttj|��S(N(tstrtinspectR(tfunc((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt_format_args$scC`stjtj|��S(N(Rt
formatargspect
getargspec(R((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyR	'st	exc_clearcC`sdS(N(tNone(((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt<lambda>-tRcC`s tj|�}|ot|�S(N(Rtisgeneratorfunctiontiscoroutinefunction(Rtgenfunc((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytis_generator2scC`s.t|dt�p-ttd�o-tj|�S(s�Return True if func is a decorated coroutine function.

    Note: copied and modified from Python 3.5's builtin couroutines.py to avoid import asyncio directly,
    which in turns also initializes the "logging" module as side-effect (see issue #8).
    t
_is_coroutineR(tgetattrtFalsethasattrRR(R((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyR7scC`soddl}tjj|j|��}tjj|�j}|j|�r]|j|�}nd||dfS(Nis%s:%di(	Rtpytpathtlocaltgetfiletbuiltint_getcodetco_firstlinenotrelto(tfunctiontcurdirRtfntlineno((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytgetlocationAscC`s�t|dd�}|sdStjjdtjjdd��}|dk	r�tg|D](}|jrV|j|jkrV|^qV�St|�S(s? return number of arguments used up by mock arguments (if any) t	patchingsitmocks
unittest.mockN(	RR
tsystmodulestgettlentattribute_nametnewtDEFAULT(R R%R&tp((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytnum_mock_patch_argsJs$)cC`sf|}xt|d�r$|j}q	W|dkrOtj|�rFdpId}n||krt|t|�7}|}nt|tj�r�tj	t
jj|j
��d}|}|t|j�}|jrx!|jD]}|j|�q�Wqntj	t
jj|��d}t|dt|dd��p1d}t|�}|rXt|||!�St||�S(Nt__wrapped__iit
func_defaultst__defaults__((RR0R
RtismethodR/t
isinstancet	functoolstpartialtgetargst_pytestt_codet
getrawcodeRR*targstkeywordstremoveRttuple(R t
startindextrealfunctiontargnamesR6tkwtdefaultstnumdefaults((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytgetfuncargnamesVs,
	"		cC`st|ttjf�S(s Return true if the object is a class. Overrides inspect.isclass for
        python 2.6 because it will return True for objects which always return
        something on __getattr__ calls (see #1035).
        Backport of https://hg.python.org/cpython/rev/35bf8f7a8edc
        (R4ttypettypest	ClassType(tobject((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytisclasstscC`sXt|t�r>|r7tj|�\}}|jd�SdSn|jd�jd�SdS(s9If val is pure ascii, returns it as a str().  Otherwise, escapes
        bytes objects into a sequence of escaped bytes:

        b'ô��' -> u'\xc3\xb4\xc5\xd6'

        and escapes unicode objects into a sequence of escaped unicode
        ids, e.g.:

        '4\nV\U00043efa\x0eMXWB\x1e\u3028\u15fd\xcd\U0007d944'

        note:
           the obvious "v.decode('unicode-escape')" will return
           valid utf-8 unicode if it finds them in bytes, but we
           want to return escaped bytes for any byte, even if they match
           a utf-8 string.

        tasciiRtunicode_escapeN(R4tbytestcodecst
escape_encodetdecodetencode(tvalt
encoded_bytest_((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt_escape_strings�s
(timapcC`sRt|t�rAy|jd�SWqNtk
r=|jd�SXn
|jd�SdS(sIn py2 bytes and str are the same type, so return if it's a bytes
        object, return it unchanged if it is a full ascii string,
        otherwise escape it into its binary form.

        If it's a unicode string, change the unicode characters into
        unicode escapes.

        RKs
string-escapesunicode-escapeN(R4RMRQtUnicodeDecodeError(RR((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyRU�s	
cC`s�|}xrtd�D].}t|dd�}|dkr;Pn|}qWtdjdtjj|�dtjj|����t|t	j
�r�|j}n|S(sq gets the real function object of the (possibly) wrapped object by
    functools.wraps or functools.partial.
    idR0s<could not find real function of {start}
stopped at {current}tstarttcurrentN(trangeRR
t
ValueErrortformatRtiotsafereprR4R5R6R(tobjt	start_objtitnew_obj((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt
get_real_func�s
	cC`s\t|�}t|d�r'|j}ntjj|�}t|dt�sXt|��|S(Ntplace_asi(	RcRRdR8R9tgetfslinenoR4tinttAssertionError(R_tfslineno((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyRe�scC`sCy|jSWn1tk
r>y|jSWq?tk
r:|SXnXdS(N(t__func__tAttributeErrortim_func(R((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt	getimfunc�s

cC`s-yt|||�SWntk
r(|SXdS(s� Like getattr but return default upon any Exception.

    Attribute access can potentially fail for 'evil' Python objects.
    See issue #214.
    N(Rt	Exception(RItnametdefault((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytsafe_getattr�s
cC`s
tjdkS(sYReturn if the test suite should fail if a @expectedFailure unittest test PASSES.

    From https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.TestResult.wasSuccessful:
        Changed in version 3.4: Returns False if there were any
        unexpectedSuccesses from tests marked with the expectedFailure() decorator.
    ii(ii(R'tversion_info(((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt)_is_unittest_unexpected_success_a_failure�scC`s
t|�S(sreturns v as string(R(tv((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytsafe_str�scC`sWyt|�SWnBtk
rRt|t�s<t|�}nd}|jd|�SXdS(s5returns v as string, converting to ascii if necessarytreplacesutf-8N(RtUnicodeErrorR4tunicodeRQ(Rsterrors((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyRt�s
t	CollectortModulet	GeneratortFunctiontInstancetSessiontItemtClasstFilet
_fillfuncargscC`shddlm}ddl}|d�|_g|j_x*tD]"}t|j|t||��q>WdS(Ni(t
ModuleTypespytest.collect(RGR�tpytesttcollectt__all__tCOLLECT_FAKEMODULE_ATTRIBUTEStsetattrR(R�R�tattr((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt_setup_collect_fakemodules
(tTextIOt	CaptureIOcB`seZd�Zd�ZRS(cC`s2tt|�jtj�dddddt�dS(NtencodingsUTF-8tnewlineRt
write_through(tsuperR�t__init__R]tBytesIOtTrue(tself((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyR�!scC`s|jj�jd�S(NsUTF-8(tbuffertgetvalueRP(R�((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyR�'s(t__name__t
__module__R�R�(((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyR� s	tFuncargnamesCompatAttrcB`seZdZed��ZRS(s� helper class so that Metafunc, Function and FixtureRequest
    don't need to each define the "funcargnames" compatibility attribute.
    cC`s|jS(s? alias attribute for ``fixturenames`` for pre-2.3 compatibility(tfixturenames(R�((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pytfuncargnames.s(R�R�t__doc__tpropertyR�(((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyR�*s(ii(ii(ii(ii(
RyRzR{R|R}R~RR�R�R�(=R�t
__future__RRRR'RRGtreR5RR8tenumRR
Rqt_PY3t_PY2RFtNoneTypeRItNOTSETtPY35tPY36tMODULE_NOT_FOUND_ERRORRR	t
isfunctionRJRRtcompilet
REGEX_TYPERRR$R/RERNtmapRVRMRtSTRING_TYPESRURwt	itertoolsRcReRlRpRrRtR�R�tpy.ioR�R�R]t
TextIOWrapperR�(((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/compat.pyt<module>s�