'L i( UdZddlmZddlmZddlZddlZddlZddlmZddlm Z ddl Z ddl m Z ddl Z ddlmZdd lmZdd lmZddlZe j&d k\rdd lmZej,j.Zd2d ZGddej4Zej8Zded<d3dZd3dZ d4dZ!d5d6dZ"d7dZ#ddd d8dZ$d9dZ%e&dDcic]}|e&ddvs|d|dc}Z'e'jQe)d d!e)d"d#e)d$d%id:d&Z*d'Z+d(Z,d;d)Z-dd.Z0Gd/d0Z1d?d1Z2ycc}w)@z?Python version compatibility code and random general utilities.) annotations)CallableN) Parameter) Signature)Path)Any)Final)NoReturn)Formatct|S)zBInternal wrapper to prepare lazy proxies for legacy_path instances) LEGACY_PATH)paths T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/_pytest/compat.py legacy_pathr#s t ceZdZdZy) NotSetTyperN)__name__ __module__ __qualname__tokenrrrr+s Errr NOTSETcJtj|xs t|ddS)azReturn 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)inspectiscoroutinefunctiongetattrfuncs rr r 1s#  & &t , Uou0UUrcFt|xstj|S)zZReturn True if the given function seems to be an async function or an async generator.)r risasyncgenfunctionr"s ris_async_functionr&=s t $ H(B(B4(HHrctjdk\r%tj|tj Stj|S)z0Return signature without evaluating annotations.r )annotation_format)sys version_infor signaturerSTRINGobjs rr+r+Cs8 7"   FF   S !!rct|}ttj|}|jj }| |j |}|d|dzS|d|dzS#t$rYwxYw)N:) get_real_funcrrgetfile__code__co_firstlineno relative_to ValueError)functioncurdirfnlinenorelfns r getlocationr=JsX&H gooh' (B    - -F  +NN6*EWAfqj\* *T6A:,     sA(( A43A4cvt|dd}|syttjjddt }ttjjddt }t |Dcgc],}|j s|j|us|j|ur|.c}Scc}w)z>Return number of arguments used up by mock arguments (if any). patchingsNrmockDEFAULTz unittest.mock)r!r)modulesgetobjectlenattribute_namenew)r8r? mock_sentinelut_mock_sentinelps rnum_mock_patch_argsrKXs+t4I CKKOOF3YIMs{{?FHU  ##-'1554D+D    s>1B6)nameclsc t|jj}tdD}|s |j}td |Ds-|r+ttj||d ts|d d}t|d r|t|d}|S#ttf$r }ddlm}|d|d|dYd}~d}~wwxYw) 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)pytraceNc3K|]d}|jtjus|jtjur*|jtj ur|j fywNkindrPOSITIONAL_OR_KEYWORD KEYWORD_ONLYdefaultemptyrM.0rJs r z"getfuncargnames..sP FFi55 5vv/// II ( sA*A,c3TK|] }|jtju"ywrS)rUrPOSITIONAL_ONLYrZs rr\z"getfuncargnames..sGqqvv222Gs&()rXr1 __wrapped__)r+ parametersvaluesr7 TypeError_pytest.outcomesrPtuplerany isinstancergetattr_static staticmethodhasattrrK)r8rMrNr`erP arg_namess rgetfuncargnamesrlks8 x(33::< I    GJG G   " "3d ;\ abM x'1(;=> G  " ) /|2aS A   s#B C/C  Cchtdt|jjDS)Nc3K|]X}|jtjtjfvr*|jtj ur|j ZywrSrTrZs rr\z(get_default_arg_names..sI 66i55y7M7MN N IIY__ , sAA )rdr+r`ra)r8s rget_default_arg_namesros2 8$//668 r z\x02x z\t z\r z\nct|tr|jdd}n |jdjd}|j 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 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. asciibackslashreplaceunicode_escape)rfbytesdecodeencode translate$_non_printable_ascii_translate_table)valrets r ascii_escapedrsI #ujj"45jj)*11': === >>rc|tj|}t|tjr |j }|S)z{Get the real function object of the (possibly) wrapped object by :func:`functools.wraps`, or :func:`functools.partial`.)runwraprf functoolspartialr#r-s rr2r2s0 .. C#y(()hh Jrc> |jS#t$r|cYSwxYwrS)__func__AttributeErrorr"s r getimfuncrs%}}  s  cDddlm} t|||S#|$r|cYSwxYw)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)rcrr!)rDrMrXrs r safe_getattrrs/.vtW-- s cL tj|S#t$rYywxYw)z0Ignore any exception via isinstance on Python 3.F)risclass Exceptionr-s r safe_isclassrs(s## s  ##ctjdk(stjdk(ryd}tj}||k7r|SdS)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)platformosgetuid)ERRORuids r get_user_idrsC ||w#,,,">iikUls,,r)r ) assert_nevercDJd|dt|jd)NzUnhandled value: z ())typer)values rrrs'J)%4;3G3G2HJJurc(eZdZdZddZddZddZy) CallableBoola' A bool-like object that can also be called, returning its true/false value. Used for backwards compatibility in cases where something was supposed to be a method but was implemented as a simple attribute by mistake (see `TerminalReporter.isatty`). Do not use in new code. c||_yrS_value)selfrs r__init__zCallableBool.__init__+s  rc|jSrSrrs r__bool__zCallableBool.__bool__. {{rc|jSrSrrs r__call__zCallableBool.__call__1rrN)rboolreturnNonerr)rrr__doc__rrrrrrrr!srrc.ddg}td|DS)z0Check if we're currently running on a CI system.CI BUILD_NUMBERc3ZK|]#}tjj|%ywrS)renvironrC)r[vars rr\z running_on_ci..:s7srzz~~c"7s)+)re)env_varss r running_on_cir5sn%H 7h7 77r)rzstr | os.PathLike[str]rr)r#rDrr)r.Callable[..., Any]rrrS)r9zstr | os.PathLike[str] | Nonerstr)rint)r8zCallable[..., object]rMrrNz type | Nonertuple[str, ...])r8rrr)rz bytes | strrr)rDrrMrrXrrr)r.rDrr)rz int | None)rr rr r)3r __future__rcollections.abcrenumrrrrrpathlibrr)typingrr r pyr* annotationlibrrlocalrrEnumrrr__annotations__r r&r+r=rKrlrorangerupdateordrr2rrrrrrr)is0rrsE"$    w$ggnn     VI "  , A#A A  A  AH $Cj(AU2s^,CAQsG}($%++Ys4y%TE: ?."-*w#K(8u(s E$ E