HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/_pytest/__pycache__/compat.cpython-310.pyc
o

%weE5�@s�UdZddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddl
mZddlZ	ddl
mZerjddlmZed�Zed�ZejjZdmdd�ZGdd�dej�Zej Z!de"d<ej#dkr�ddl$Z%e%j&Z'nddl'Z'dnd d!�Z(dod$d%�Z)dod&d'�Z*dod(d)�Z+dpdqd,d-�Z,drd/d0�Z-d1d2dd3�dsd:d;�Z.dtd<d=�Z/d>d?�e0d@�D�Z1e1�2e3dA�dBe3dC�dDe3dE�dFi�dudHdI�Z4e5e6fZ7dvdLdM�Z8dwdOdP�Z9ej:GdQdR�dR��Z;dSdT�Z<dUdV�Z=dWdX�Z>dxd[d\�Z?dyd^d_�Z@e�r.ej#dk�r'dd`l
mAZAndd`lmAZAnej#dk�r;dd`l
mAZAndadb�ZAej#dk�rLddclmBZBnGddde�deeeef�ZBdzdgdh�ZCd{dkdl�ZDdS)|z"Python version compatibility code.�)�annotationsN)�	Parameter)�	signature)�Path)�Any)�Callable)�Generic)�NoReturn)�
TYPE_CHECKING)�TypeVarT)�overload)�Final�_T�_S�path�str | os.PathLike[str]�return�LEGACY_PATHcCst|�S)zBInternal wrapper to prepare lazy proxies for legacy_path instances)r)r�r�G/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/compat.py�legacy_path0src@seZdZdZdS)�
NotSetTyperN)�__name__�
__module__�__qualname__�tokenrrrrr8srr
�NOTSET)���func�Callable[..., Any]�strcCstt|��S�N)r!r�rrrr�_format_argsE�r$�object�boolcCst�|�}|ot|�Sr")�inspect�isgeneratorfunction�iscoroutinefunction)r�genfuncrrr�is_generatorIs
r,cCst�|�p
t|dd�S)a{Return True if func is a coroutine function (a function defined with async
    def syntax, and doesn't contain yield), or a function decorated with
    @asyncio.coroutine.

    Note: copied and modified from Python 3.5's builtin couroutines.py to avoid
    importing asyncio directly, which in turns also initializes the "logging"
    module as a side-effect (see issue #8).
    �
_is_coroutineF)r(r*�getattrr#rrrr*Ns	r*cCst|�pt�|�S)zZReturn True if the given function seems to be an async function or
    an async generator.)r*r(�isasyncgenfunctionr#rrr�is_async_functionZsr0�curdir�
str | NonecCsht|�}tt�|��}|jj}|dur,z|�|�}Wn	ty#Yn	wd||dfSd||dfS)Nz%s:%d�)�
get_real_funcrr(�getfile�__code__�co_firstlineno�relative_to�
ValueError)�functionr1�fn�lineno�relfnrrr�getlocation`s�r>�intcsXt|dd�}|s
dSttj�d�dt���ttj�d�dt���t��fdd�|D��S)	z>Return number of arguments used up by mock arguments (if any).�	patchingsNr�mock�DEFAULTz
unittest.mockcs*g|]}|js|j�us|j�ur|�qSr)�attribute_name�new��.0�p��
mock_sentinel�ut_mock_sentinelrr�
<listcomp>xs��z'num_mock_patch_args.<locals>.<listcomp>)r.�sys�modules�getr&�len)r:r@rrHr�num_mock_patch_argsns��rP�F)�name�	is_method�clsr:rRrSrT�type | None�tuple[str, ...]c
Cs�zt|�j}Wn&ttfy-}zddlm}|d|�d|��dd�WYd}~nd}~wwtdd	�|��D��}|s>|j}|sM|rSt	t
j||dd
�t�sS|dd�}t
|d�r`|t|�d�}|S)
aLReturn the names of a function's mandatory arguments.

    Should return the names of all function arguments that:
    * Aren't bound to an instance or type as in instance or class methods.
    * Don't have default values.
    * Aren't bound with functools.partial.
    * Aren't replaced with mocks.

    The is_method and cls arguments indicate that the function should
    be treated as a bound method even though it's not unless, only in
    the case of cls, the function is a static method.

    The name parameter should be the original name in which the function was collected.
    r)�failz!Could not determine arguments of z: F)�pytraceNcss:�|]}|jtjus|jtjur|jtjur|jVqdSr"��kindr�POSITIONAL_OR_KEYWORD�KEYWORD_ONLY�default�emptyrRrErrr�	<genexpr>�s���z"getfuncargnames.<locals>.<genexpr>)r]r3�__wrapped__)r�
parametersr9�	TypeError�_pytest.outcomesrW�tuple�valuesr�
isinstancer(�getattr_static�staticmethod�hasattrrP)r:rRrSrTra�erW�	arg_namesrrr�getfuncargnames�s4����	���
rlcCstdd�t|�j��D��S)Ncss4�|]}|jtjtjfvr|jtjur|jVqdSr"rYrErrrr_�s���z(get_default_arg_names.<locals>.<genexpr>)rdrrare)r:rrr�get_default_arg_names�s�rmcCs(i|]}|tdd�vr|d|d���qS)� �z\x�02x)�range)rF�irrr�
<dictcomp>�s"rs��	z\t�
z\r�
z\n�scCs
|�t�Sr")�	translate�$_non_printable_ascii_translate_table)rxrrr�_translate_non_printable�s
r{�val�bytescCs|�dd�S)N�ascii�backslashreplace)�decode)r|rrr�_bytes_to_ascii�r%r��bytes | strcCs2t|t�r
t|�}t|�S|�d��d�}t|�S)aIf val is pure ASCII, return it as an str, otherwise, escape
    bytes objects into a sequence of escaped bytes:

    b'\xc3\xb4\xc5\xd6' -> r'\xc3\xb4\xc5\xd6'

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

    r'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.
    �unicode_escaper~)rfr}r��encoder�r{)r|�retrrr�
ascii_escaped�s

�r�c@seZdZUdZded<dS)�_PytestWrappera%Dummy wrapper around a function object for internal use only.

    Used to correctly unwrap the underlying function object when we are
    creating fixtures, because we wrap the function object ourselves with a
    decorator to issue warnings when the fixture function is called directly.
    r�objN)rrr�__doc__�__annotations__rrrrr��s
r�cCs�|}td�D] }t|dd�}t|t�r|j}n"t|dd�}|dur$n|}qddlm}tdj||�||�d���t|t	j
�rC|j}|S)	zjGet the real function object of the (possibly) wrapped object by
    functools.wraps or functools.partial.�d�__pytest_wrapped__Nr`r)�safereprz<could not find real function of {start}
stopped at {current})�start�current)rqr.rfr�r��_pytest._io.safereprr�r9�format�	functools�partialr)r��	start_objrr�new_objr�rrrr4
s&
��r4cCsTzt|d�}t|�}Wnty|YSw|r(t|d�r(t|j�r(|�|�}|S)z�Attempt to obtain the real function object that might be wrapping
    ``obj``, while at the same time returning a bound method to ``holder`` if
    the original object was a bound method.�__func__�__get__)rir4�	Exception�callabler�)r��holderrSrrr�get_real_method's
�
r�cCs z|jWSty|YSwr")r��AttributeErrorr#rrr�	getimfunc5s
�r�rr]cCs2ddlm}zt|||�WS|y|YSw)aRLike getattr but return default upon any Exception or any OutcomeException.

    Attribute access can potentially fail for 'evil' Python objects.
    See issue #214.
    It catches OutcomeException because of #2490 (issue #580), new outcomes
    are derived from BaseException instead of Exception (for more details
    check #2707).
    r)�TEST_OUTCOME)rcr�r.)r&rRr]r�rrr�safe_getattr<s	�r�r�cCs"zt�|�WStyYdSw)z0Ignore any exception via isinstance on Python 3.F)r(�isclassr�)r�rrr�safe_isclassMs
�r�)�finalcCs|Sr"r)�frrrr�^sr�)�cached_propertyc@sFeZdZdZddd�Ze	ddd
d��Zedddd��Zddd�ZdS)r��rr�r�Callable[[_S], _T]r�NonecCs||_|j|_dSr"r�)�selfrrrr�__init__iszcached_property.__init__.�instance�owner�type[_S] | None�cached_property[_S, _T]cC�dSr"r�r�r�r�rrrr�mszcached_property.__get__rrcCr�r"rr�rrrr�ssNcCs(|dur|S|�|�}|j|jj<|Sr")r�__dict__r)r�r�r��valuerrrr�ws)rr�rr�).)r�r�r�r�rr�)r�rr�r�rrr")rrr�	__slots__r�rr�rrrrr�fs
�r��
int | NonecCs4tjdks
tjdkrdSd}t��}||kr|SdS)z�Return the current process's real user id or None if it could not be
    determined.

    :return: The user id or None if it could not be determined.
    �win32�
emscriptenN���)rL�platform�os�getuid)�ERROR�uidrrr�get_user_id~s
	r�r�r	cCsJd|�dt|�j�d���)NFzUnhandled value: z (�))�typer)r�rrr�assert_never�sr�)rrrr)rr rr!)rr&rr'r")r1r2rr!)rr?)
r:r rRr!rSr'rTrUrrV)r:r rrV)rxr!rr!)r|r}rr!)r|r�rr!)r&rrRr!r]rrr)r�r&rr')rr�)r�r	rr	)Er��
__future__r�dataclasses�enumr�r(r�rLrr�pathlibr�typingrrrr	r
r�pyr�typing_extensionsr
rrr�localrr�Enumrrrr��version_info�importlib.metadata�	importlib�metadata�importlib_metadatar$r,r*r0r>rPrlrmrqrz�update�ordr{r}r!�STRING_TYPESr�r��	dataclassr�r4r�r�r�r�r�r�r�r�rrrr�<module>s�	






�
F��





4