o
    Ú­jE5  ã                   @  sÈ  U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddlm	Z	 ddlm
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlZ	 ddlmZ erjddlmZ edƒZedƒZejjZdmdd„ZG dd„ dejƒZej Z!de"d< ej#dkr˜ddl$Z%e%j&Z'nddl'Z'dnd d!„Z(dod$d%„Z)dod&d'„Z*dod(d)„Z+dpdqd,d-„Z,drd/d0„Z-d1d2dd3œdsd:d;„Z.dtd<d=„Z/d>d?„ e0d@ƒD ƒZ1e1 2e3dAƒdBe3dCƒdDe3dEƒdFi¡ dudHdI„Z4e5e6fZ7dvdLdM„Z8dwdOdP„Z9ej:G dQdR„ dRƒƒZ;dSdT„ Z<dUdV„ Z=dWdX„ Z>dxd[d\„Z?dyd^d_„Z@e�r.ej#dk�r'dd`lmAZA ndd`lmAZA nej#dk�r;dd`lmAZA ndadb„ ZAej#dk�rLddclmBZB nG ddde„ deeeef ƒZBdzdgdh„ZCd{dkdl„ZDdS )|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_PATHc                 C  s   t | ƒS )zBInternal wrapper to prepare lazy proxies for legacy_path instances)r   )r   © r   úK/var/www/html/CropPilot/venv/lib/python3.10/site-packages/_pytest/compat.pyÚlegacy_path0   s   r   c                   @  s   e Zd ZdZdS )Ú
NotSetTyper   N)Ú__name__Ú
__module__Ú__qualname__Útokenr   r   r   r   r   8   s    r   r   ÚNOTSET)é   é   ÚfuncúCallable[..., Any]Ústrc                 C  s   t t| ƒƒS ©N)r!   r   ©r   r   r   r   Ú_format_argsE   ó   r$   ÚobjectÚboolc                 C  s   t  | ¡}|ot| ƒ S r"   )ÚinspectÚisgeneratorfunctionÚiscoroutinefunction)r   Úgenfuncr   r   r   Úis_generatorI   s   
r,   c                 C  s   t  | ¡p
t| ddƒ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#   r   r   r   r*   N   s   	r*   c                 C  s   t | ƒpt | ¡S )zZReturn True if the given function seems to be an async function or
    an async generator.)r*   r(   Úisasyncgenfunctionr#   r   r   r   Úis_async_functionZ   s   r0   Úcurdirú
str | Nonec                 C  sh   t | ƒ} tt | ¡ƒ}| jj}|d ur,z| |¡}W n	 ty#   Y n	w d||d f S d||d f S )Nz%s:%dé   )Úget_real_funcr   r(   ÚgetfileÚ__code__Úco_firstlinenoÚrelative_toÚ
ValueError)Úfunctionr1   ÚfnÚlinenoÚrelfnr   r   r   Úgetlocation`   s   ÿr>   Úintc                   sX   t | ddƒ}|s
dS t tj d¡dtƒ ƒ‰ t tj d¡dtƒ ƒ‰t‡ ‡fdd„|D ƒƒS )	z>Return number of arguments used up by mock arguments (if any).Ú	patchingsNr   ÚmockÚDEFAULTzunittest.mockc                   s*   g | ]}|j s|jˆ u s|jˆu r|‘qS r   )Úattribute_nameÚnew©Ú.0Úp©Úmock_sentinelÚut_mock_sentinelr   r   Ú
<listcomp>x   s    ýýz'num_mock_patch_args.<locals>.<listcomp>)r.   ÚsysÚmodulesÚgetr&   Úlen)r:   r@   r   rH   r   Únum_mock_patch_argsn   s   þÿrP   Ú F)ÚnameÚ	is_methodÚclsr:   rR   rS   rT   útype | Noneútuple[str, ...]c             
   C  sÄ   zt | ƒj}W n& ttfy- } zddlm} |d| ›d|› �dd� W Y d}~nd}~ww tdd	„ | ¡ D ƒƒ}|s>| j}|sM|rSt	t
j||dd
�tƒsS|dd… }t| dƒr`|t| ƒd… }|S )aL  Return 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)ÚpytraceNc                 s  s:   � | ]}|j tju s|j tju r|jtju r|jV  qd S r"   ©Úkindr   ÚPOSITIONAL_OR_KEYWORDÚKEYWORD_ONLYÚdefaultÚemptyrR   rE   r   r   r   Ú	<genexpr>©   s   € úùz"getfuncargnames.<locals>.<genexpr>)r]   r3   Ú__wrapped__)r   Ú
parametersr9   Ú	TypeErrorÚ_pytest.outcomesrW   ÚtupleÚvaluesr   Ú
isinstancer(   Úgetattr_staticÚstaticmethodÚhasattrrP   )r:   rR   rS   rT   ra   ÚerW   Ú	arg_namesr   r   r   Úgetfuncargnames�   s4   þ€ýþ	ýÿü
rl   c                 C  s   t dd„ t| ƒj ¡ D ƒƒS )Nc                 s  s4   � | ]}|j tjtjfv r|jtjur|jV  qd S r"   rY   rE   r   r   r   r_   Ë   s   € ýüz(get_default_arg_names.<locals>.<genexpr>)rd   r   ra   re   )r:   r   r   r   Úget_default_arg_namesÇ   s   þrm   c                 C  s(   i | ]}|t d dƒvr|d|d›�“qS )é    é   z\xÚ02x)Úrange)rF   Úir   r   r   Ú
<dictcomp>Ó   s    "rs   é€   ú	z\túz\rÚ
z\nÚsc                 C  s
   |   t¡S r"   )Ú	translateÚ$_non_printable_ascii_translate_table)rx   r   r   r   Ú_translate_non_printableÛ   s   
r{   ÚvalÚbytesc                 C  s   |   dd¡S )NÚasciiÚbackslashreplace)Údecode)r|   r   r   r   Ú_bytes_to_asciiâ   r%   r�   úbytes | strc                 C  s2   t | tƒrt| ƒ}t|ƒS |  d¡ d¡}t|ƒS )a  If 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~   )rf   r}   r�   Úencoder€   r{   )r|   Úretr   r   r   Úascii_escapedæ   s
   
ÿr†   c                   @  s   e Zd ZU dZded< dS )Ú_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)r   r   r   Ú__doc__Ú__annotations__r   r   r   r   r‡   þ   s   
 r‡   c                 C  sŠ   | }t dƒD ] }t| ddƒ}t|tƒr|j}  n"t| ddƒ}|du r$ n|} qddlm} tdj||ƒ|| ƒ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)rq   r.   rf   r‡   rˆ   Ú_pytest._io.safereprr�   r9   ÚformatÚ	functoolsÚpartialr   )rˆ   Ú	start_objrr   Únew_objr�   r   r   r   r4   
  s&   
ÿÿr4   c                 C  sT   zt | dƒ}t| ƒ} W n ty   |  Y S w |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__)ri   r4   Ú	ExceptionÚcallabler—   )rˆ   ÚholderrS   r   r   r   Úget_real_method'  s   
ÿ
r›   c                 C  s    z| j W S  ty   |  Y S w r"   )r–   ÚAttributeErrorr#   r   r   r   Ú	getimfunc5  s
   ÿr�   r   r]   c                 C  s2   ddl m} zt| ||ƒW S  |y   | Y S w )aR  Like 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)rc   rž   r.   )r&   rR   r]   rž   r   r   r   Úsafe_getattr<  s   	ÿrŸ   rˆ   c                 C  s"   zt  | ¡W S  ty   Y dS w )z0Ignore any exception via isinstance on Python 3.F)r(   Úisclassr˜   )rˆ   r   r   r   Úsafe_isclassM  s
   ÿr¡   )Úfinalc                 C  s   | S r"   r   )Úfr   r   r   r¢   ^  s   r¢   )Úcached_propertyc                   @  sF   e Zd ZdZddd„Ze	dddd„ƒZedddd„ƒZddd„ZdS )r¤   ©r   r‰   r   úCallable[[_S], _T]r   ÚNonec                 C  s   || _ |j| _d S r"   r¥   )Úselfr   r   r   r   Ú__init__i  s   zcached_property.__init__.ÚinstanceÚownerútype[_S] | Noneúcached_property[_S, _T]c                 C  ó   d S r"   r   ©r¨   rª   r«   r   r   r   r—   m  s   zcached_property.__get__r   r   c                 C  r®   r"   r   r¯   r   r   r   r—   s  s   Nc                 C  s(   |d u r| S |   |¡ }|j| j j< |S r"   )r   Ú__dict__r   )r¨   rª   r«   Úvaluer   r   r   r—   w  s   )r   r¦   r   r§   ).)rª   r§   r«   r¬   r   r­   )rª   r   r«   r¬   r   r   r"   )r   r   r   Ú	__slots__r©   r   r—   r   r   r   r   r¤   f  s    
ÿr¤   ú
int | Nonec                  C  s4   t jdks
t jdkrdS d} t ¡ }|| kr|S dS )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Úuidr   r   r   Úget_user_id~  s
   	r¼   r±   r	   c                 C  s   J d| › dt | ƒj› d�ƒ‚)NFzUnhandled value: z (ú))Útyper   )r±   r   r   r   Úassert_never²  s   r¿   )r   r   r   r   )r   r    r   r!   )r   r&   r   r'   r"   )r1   r2   r   r!   )r   r?   )
r:   r    rR   r!   rS   r'   rT   rU   r   rV   )r:   r    r   rV   )rx   r!   r   r!   )r|   r}   r   r!   )r|   r‚   r   r!   )r&   r   rR   r!   r]   r   r   r   )rˆ   r&   r   r'   )r   r³   )r±   r	   r   r	   )Er‰   Ú
__future__r   ÚdataclassesÚenumr’   r(   r¸   rL   r   r   Úpathlibr   Útypingr   r   r   r	   r
   r   Úpyr   Útyping_extensionsr   r   r   r   Úlocalr   r   ÚEnumr   r   r   rŠ   Úversion_infoÚimportlib.metadataÚ	importlibÚmetadataÚimportlib_metadatar$   r,   r*   r0   r>   rP   rl   rm   rq   rz   ÚupdateÚordr{   r}   r!   ÚSTRING_TYPESr�   r†   Ú	dataclassr‡   r4   r›   r�   rŸ   r¡   r¢   r¤   r¼   r¿   r   r   r   r   Ú<module>   s�    	






û
Fÿÿ





4