Your IP : 216.73.216.196


Current Path : /opt/alt/python37/lib/python3.7/site-packages/_pytest/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/_pytest/__pycache__/compat.cpython-37.pyc

B

C$�X{�@s�dZddlZddlZddlZddlZddlZddlZddlZyddlZWne	k
r`dZYnXej
dkZeZe
d�Ze�Zej
dd�dkZer�dndZeed�r�d	d
�Zndd
�ZejZejZeedd
d��Ze
e�d��Zdd�Zdd�Zdd�Zdd�Zd-dd�Zej
dd�dk�r*dd�Ze�rJddl Z e!e"fZ#dd�Z$ne!e"e%fZ#dd�Z$d d!�Z&d"d#�Z'd$d%�Z(d&d'�Z)d(d)�Z*e�r�d*d+�Z+nd,d+�Z+dS).z#
python version compatibility code
�N)�r�)r��ModuleNotFoundError�ImportError�	signaturecCstt�|��S)N)�str�inspectr)�func�r�?/opt/alt/python37/lib/python3.7/site-packages/_pytest/compat.py�_format_args"sr
cCstjt�|��S)N)r	�
formatargspec�
getargspec)r
rrrr
%s�	exc_clearcCsdS)Nrrrrr�<lambda>+�r�cCst�|�}|ot|�S)N)r	�isgeneratorfunction�iscoroutinefunction)r
Zgenfuncrrr�is_generator0s
rcCs t|dd�pttd�ot�|�S)z�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).
    Z
_is_coroutineFr)�getattr�hasattrr	r)r
rrrr5srcCsLddl}tj�|�|��}tj�|�j}|�|�r<|�|�}d||dfS)Nrz%s:%d�)	r	�py�path�local�getfile�builtinZ_getcode�co_firstlinenoZrelto)�function�curdirr	�fn�linenorrr�getlocation?s

r$csRt|dd�}|sdStj�dtj�dd����dk	rJt�fdd�|D��St|�S)z? return number of arguments used up by mock arguments (if any) �	patchingsNr�mockz
unittest.mockcs"g|]}|js|j�jkr|�qSr)Zattribute_name�new�DEFAULT)�.0�p)r&rr�
<listcomp>Osz'num_mock_patch_args.<locals>.<listcomp>)r�sys�modules�get�len)r r%r)r&r�num_mock_patch_argsHsr0cCs|}xt|d�r|j}qW|dkr4t�|�r0dp2d}||krL|t|�7}|}t|tj�r�t�t	j
�|j��d}|}|t
|j�d�}|jr�x0|jD]}|�|�q�Wnt�t	j
�|��d}t|dt|dd��p�d}t
|�}|r�t|||��St||d��S)N�__wrapped__rrZ
func_defaults�__defaults__r)rr1r	�ismethodr0�
isinstance�	functools�partial�getargs�_pytest�_codeZ
getrawcoder
r/�args�keywords�remover�tuple)r Z
startindexZrealfunction�argnamesr6�kw�defaultsZnumdefaultsrrr�getfuncargnamesTs,
rA)rrcCst|ttjf�S)a 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
        )r4�type�typesZ	ClassType)�objectrrr�isclassrsrEcCs@t|t�r,|r&t�|�\}}|�d�SdSn|�d��d�SdS)u=If 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.

        �asciirZunicode_escapeN)r4�bytes�codecs�
escape_encode�decode�encode)�valZ
encoded_bytes�_rrr�_escape_strings�s

rNcCs@t|t�r2y
|�d�Stk
r.|�d�SXn
|�d�SdS)aIn 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.

        rFz
string-escapezunicode-escapeN)r4rGrK�UnicodeDecodeError)rLrrrrN�s	

cCs,xt|d�r|j}qWt|tj�r(|j}|S)zq gets the real function object of the (possibly) wrapped object by
    functools.wraps or functools.partial.
    r1)rr1r4r5r6r
)�objrrr�
get_real_func�s

rQcCs>t|�}t|d�r|j}tj�|�}t|dt�s:t|��|S)N�place_asr)	rQrrRr8r9�getfslinenor4�int�AssertionError)rPZfslinenorrrrS�s
rScCs<y|jStk
r6y|jStk
r0|SXYnXdS)N)�__func__�AttributeErrorZim_func)r
rrr�	getimfunc�srXcCs&yt|||�Stk
r |SXdS)z� Like getattr but return default upon any Exception.

    Attribute access can potentially fail for 'evil' Python objects.
    See issue214
    N)r�	Exception)rD�name�defaultrrr�safe_getattr�sr\cCs
tjdkS)aYReturn 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.
    )r�)r,�version_inforrrr�)_is_unittest_unexpected_success_a_failure�sr_cCst|�S)zreturns v as string)r)�vrrr�safe_str�sracCs.yt|�Stk
r(d}|�d|�SXdS)z5returns v as string, converting to ascii if necessary�replacerFN)r�UnicodeErrorrK)r`�errorsrrrra�s
)N),�__doc__r,r	rC�rer5rr8�enumrr^Z_PY3Z_PY2rBZNoneTyperDZNOTSETZPY36ZMODULE_NOT_FOUND_ERRORrr
�
isfunctionrErr�compileZ
REGEX_TYPErrr$r0rArHrGrZSTRING_TYPESrN�unicoderQrSrXr\r_rarrrr�<module>sZ