
    ?g,              	         % S r SSKJr  SSKrSSKrSSKrSSKrSSKJr  SSKJr  SSK	r	SSK
Jr  SSKrSSKJr  SSKJr  SS	KJr  SS
KJr  SSKr\R&                  R(                  rS.S jr " S S\R.                  5      r\R2                  rS\S'   S/S jrS/S jrS/S jrS0S1S jjrS2S jr SSS.       S3S jjr!S4S jr"\#" S5       V s0 s H  o \#" SS5      ;  d  M  U SU S 3_M     sn r$\$RK                  \&" S5      S\&" S 5      S!\&" S"5      S#05        S5S$ jr'\RP                   " S% S&5      5       r)S' r*S( r+S) r,S6S* jr-S7S+ jr.S8S, jr/S9S- jr0gs  sn f ):z"Python version compatibility code.    )annotationsN)	Parameter)	signature)Path)Any)Callable)Final)NoReturnc                    [        U 5      $ )zBInternal wrapper to prepare lazy proxies for legacy_path instances)LEGACY_PATH)paths    0/usr/lib/python3/dist-packages/_pytest/compat.pylegacy_pathr       s    t    c                      \ rS rSrSrSrg)
NotSetType(   r    N)__name__
__module____qualname____firstlineno__token__static_attributes__r   r   r   r   r   (   s    Er   r   r	   NOTSETc                `    [         R                  " U 5      nU=(       a    [        U 5      (       + $ N)inspectisgeneratorfunctioniscoroutinefunction)funcgenfuncs     r   is_generatorr#   .   s&    ))$/G4.t444r   c                V    [         R                  " U 5      =(       d    [        U SS5      $ )ab  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 coroutines.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    getattrr!   s    r   r    r    3   s#     &&t,Uou0UUr   c                R    [        U 5      =(       d    [        R                  " U 5      $ )zVReturn True if the given function seems to be an async function or
an async generator.)r    r   isasyncgenfunctionr'   s    r   is_async_functionr*   ?   s     t$H(B(B4(HHr   c                    [        U 5      n [        [        R                  " U 5      5      nU R                  R
                  nUb   UR                  U5      nSXCS-   4-  $ SX#S-   4-  $ ! [         a     Nf = f)Nz%s:%d   )get_real_funcr   r   getfile__code__co_firstlinenorelative_to
ValueError)functioncurdirfnlinenorelfns        r   getlocationr8   E   s    X&H	gooh'	(B--F	1NN6*E eaZ000b1*%%%	  		s   A( (
A54A5c                   [        U SS5      nU(       d  g[        [        R                  R                  S5      S[	        5       5      n[        [        R                  R                  S5      S[	        5       5      n[        U Vs/ s H8  nUR                  (       a  M  UR                  UL d  UR                  UL d  M6  UPM:     sn5      $ s  snf )z>Return number of arguments used up by mock arguments (if any).	patchingsNr   mockDEFAULTzunittest.mock)r&   sysmodulesgetobjectlenattribute_namenew)r3   r:   mock_sentinelut_mock_sentinelps        r   num_mock_patch_argsrG   S   s    +t4ICKKOOF3YIMs{{?FHU 	
##  -'1554D+D 	
 	
s   C	C	<C	 )nameclsc                   [        U 5      R                  n[        S WR                  5        5       5      nU(       d  U R                  nU(       a-  [        [        R                  " X!SS	9[        5      (       d  US
S n[        U S5      (       a  U[        U 5      S nU$ ! [        [        4 a  nSSKJn  U" SU < SU 3SS9   SnANSnAff = f)a  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 cls arguments indicate that the function should be treated as a bound
method even though it's not unless 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              3     #    U  Hl  nUR                   [        R                  L d  UR                   [        R                  L d  M?  UR                  [        R
                  L d  M^  UR                  v   Mn     g 7fr   kindr   POSITIONAL_OR_KEYWORDKEYWORD_ONLYdefaultemptyrI   .0rF   s     r   	<genexpr>"getfuncargnames.<locals>.<genexpr>   sX      $AFFi555vv///	 	 II( 	$s   >A6A6#A6)rS   r,   __wrapped__)r   
parametersr2   	TypeError_pytest.outcomesrL   tuplevaluesr   
isinstancer   getattr_staticstaticmethodhasattrrG   )r3   rI   rJ   rZ   erL   	arg_namess          r   getfuncargnamesre   f   s    8
x(33
  ""$ I    	""3d;\
 
 abM	x''1(;=>	G 	" 
)/|2aSA	

s   B C/CCc                h    [        S [        U 5      R                  R                  5        5       5      $ )Nc              3     #    U  H`  nUR                   [        R                  [        R                  4;   d  M3  UR                  [        R
                  Ld  MR  UR                  v   Mb     g 7fr   rO   rU   s     r   rW   (get_default_arg_names.<locals>.<genexpr>   sQ      8A66i55y7M7MNN 	 IIY__, 	8s   2A*A*A*)r]   r   rZ   r^   )r3   s    r   get_default_arg_namesri      s2      8$//668  r             z\x02x	z\tz\r
z\nc                    [        U [        5      (       a  U R                  SS5      nO U R                  S5      R                  S5      nUR	                  [
        5      $ )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 strings 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.
asciibackslashreplaceunicode_escape)r_   bytesdecodeencode	translate$_non_printable_ascii_translate_table)valrets     r   ascii_escapedr|      sL      #ujj"45jj)*11':===>>r   c                  $    \ rS rSr% SrS\S'   Srg)_PytestWrapper   a  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   objr   N)r   r   r   r   __doc____annotations__r   r   r   r   r~   r~      s     
Hr   r~   c                R   U n[        S5       HG  n[        U SS5      n[        U[        5      (       a  UR                  n   O;[        U SS5      nUc    O)Un MI     SSKJn  [        SU" U5       SU" U 5       35      e[        U [        R                  5      (       a  U R                  n U $ )	zfGet the real function object of the (possibly) wrapped object by
functools.wraps or functools.partial.d   __pytest_wrapped__NrY   r   )safereprz could not find real function of z
stopped at )ranger&   r_   r~   r   _pytest._io.safereprr   r2   	functoolspartialr!   )r   	start_objinew_objr   s        r   r-   r-      s     I3Z #3T:g~..++C#}d3?  	2.x	/B.C=QYZ]Q^P_`
 	
 #y(())hhJr   c                     [        U S5      n[        U 5      n U(       a<  [        U S5      (       a+  [        U R                  5      (       a  U R	                  U5      n U $ ! [         a    U s $ f = f)zAttempt 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__)rb   r-   	Exceptioncallabler   )r   holder	is_methods      r   get_real_methodr      se    C,	C  WS),,#++1F1Fkk&!J	  
s   A A-,A-c                @     U R                   $ ! [         a    U s $ f = fr   )r   AttributeErrorr'   s    r   	getimfuncr   
  s%    }} s    c                D    SSK Jn   [        XU5      $ ! U a    Us $ f = f)a:  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)r\   r   r&   )r@   rI   rS   r   s       r   safe_getattrr     s-     .vW-- s    c                P     [         R                  " U 5      $ ! [         a     gf = f)z0Ignore any exception via isinstance on Python 3.F)r   isclassr   )r   s    r   safe_isclassr   "  s(    s## s    
%%c                     [         R                  S:X  d  [         R                  S:X  a  gSn [        R                  " 5       nX:w  a  U$ S$ )zReturn 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)r=   platformosgetuid)ERRORuids     r   get_user_idr   *  sA     ||w#,,,">  iikls,,r   c                D     SU  S[        U 5      R                   S35       e)NzUnhandled value: z ())typer   )values    r   assert_neverr   ^  s'    F%eWBtE{/C/C.DAFF5r   )r   zstr | os.PathLike[str]returnr   )r!   r@   r   boolr   )r4   zstr | os.PathLike[str] | Noner   str)r   int)r3   zCallable[..., object]rI   r   rJ   ztype | Noner   tuple[str, ...])r3   zCallable[..., Any]r   r   )rz   zbytes | strr   r   )r@   r   rI   r   rS   r   r   r   )r   r@   r   r   )r   z
int | None)r   r
   r   r
   )1r   
__future__r   dataclassesenumr   r   r   r   r   pathlibr   r=   typingr   r   r	   r
   pyr   localr   r   Enumr   r   r   r   r#   r    r*   r8   rG   re   ri   r   ry   updateordr|   	dataclassr~   r-   r   r   r   r   r   r   )r   s   0r   <module>r      sx   ( "       	  
     	 ggnn     5
	VI&, 	A#A A 
	A
 AH	 $Cj((U2s^,CAQsG}j( $ % + +Ys4y%TE:
?.   6"-hGQ(s   E E