python (3.11.7)

(root)/
lib/
python3.11/
__pycache__/
contextlib.cpython-311.opt-1.pyc

ek|dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZgdZGddej
ZGd	d
ej
ZGddeZGd
deZGddZGddeeeZGddeeeZdZdZGddeZGddeZGddeZGddeZGdd eZGd!d"eZGd#d$ZGd%d&eeZGd'd(eeZ Gd)d*eeZ!Gd+d,eZ"dS)-z4Utilities for with-statement contexts.  See PEP 343.N)dequewraps)
MethodTypeGenericAlias)asynccontextmanagercontextmanagerclosingnullcontextAbstractContextManagerAbstractAsyncContextManagerAsyncExitStackContextDecorator	ExitStackredirect_stdoutredirect_stderrsuppressaclosingchdircdeZdZdZeeZdZej	dZ
edZdS)rz,An abstract base class for context managers.c|Sz0Return `self` upon entering the runtime context.selfs >/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/contextlib.py	__enter__z AbstractContextManager.__enter__scdSz9Raise any exception triggered within the runtime context.Nrrexc_type	exc_value	tracebacks    r__exit__zAbstractContextManager.__exit__s	trcN|turtj|ddStS)Nrr%)r_collections_abc_check_methodsNotImplementedclsCs  r__subclasshook__z'AbstractContextManager.__subclasshook__ s)(((#21k:NNNrN)__name__
__module____qualname____doc__classmethodr__class_getitem__rabcabstractmethodr%r-rrrrrss66#L11	[rrcdeZdZdZeeZdZej	dZ
edZdS)r
z9An abstract base class for asynchronous context managers.c
K|Srrrs r
__aenter__z&AbstractAsyncContextManager.__aenter__-src
KdSr rr!s    r	__aexit__z%AbstractAsyncContextManager.__aexit__1s
trcN|turtj|ddStS)Nr8r:)r
r'r(r)r*s  rr-z,AbstractAsyncContextManager.__subclasshook__6s3---#21l3>@@
@rN)r.r/r0r1r2rr3r8r4r5r:r-rrrr
r
'ssCC#L11	[rr
ceZdZdZdZdZdS)rzJA base class or mixin that enables context managers to work as decorators.c|S)a6Return a recreated instance of self.

        Allows an otherwise one-shot context manager like
        _GeneratorContextManager to support use as
        a decorator via implicit recreation.

        This is a private interface just for _GeneratorContextManager.
        See issue #11647 for details.
        rrs r_recreate_cmzContextDecorator._recreate_cmAs	rc@tfd}|S)Ncp5|i|cdddS#1swxYwYdSNr>argskwdsfuncrs  rinnerz(ContextDecorator.__call__.<locals>.innerNs""$$
+
+tT*T**
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+s+//rrrFrGs`` r__call__zContextDecorator.__call__Ms9	t	+	+	+	+	+
	+rNr.r/r0r1r>rIrrrrr>s8PP


rrceZdZdZdZdZdS)AsyncContextDecoratorzPA base class or mixin that enables async context managers to work as decorators.c|S)z-Return a recreated instance of self.
        rrs rr>z"AsyncContextDecorator._recreate_cmXs	rc@tfd}|S)NcK4d{V|i|d{Vcdddd{VS#1d{VswxYwYdSrArBrCs  rrGz-AsyncContextDecorator.__call__.<locals>.inner^s((**
1
1
1
1
1
1
1
1!T40400000000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1s?
A	A	rrHs`` rrIzAsyncContextDecorator.__call__]s9	t	1	1	1	1	1
	1rNrJrrrrLrLUs8VV
rrLceZdZdZdZdZdS)_GeneratorContextManagerBasezBShared functionality for @contextmanager and @asynccontextmanager.c||i||_|||c|_|_|_t	|dd}|t|j}||_dS)Nr1)genrFrDrEgetattrtyper1)rrFrDrEdocs     r__init__z%_GeneratorContextManagerBase.__init__hs]4&&&*.d'	49didIt,,;t**$CrcN||j|j|jSrA)	__class__rFrDrErs rr>z)_GeneratorContextManagerBase._recreate_cmvs ~~diDI>>>rN)r.r/r0r1rWr>rrrrQrQes8LL?????rrQceZdZdZdZdZdS)_GeneratorContextManagerz%Helper for @contextmanager decorator.ct|`|`|`	t|jS#t
$rt
ddwxYwNzgenerator didn't yield)rDrErFnextrS
StopIterationRuntimeErrorrs rrz"_GeneratorContextManager.__enter__sU
Ity$)	C>>!	C	C	C788dB	Cs7cf|T	t|j	td#|jwxYw#t$rYdSwxYw|
|}	|j|||n#t$r}||ucYd}~Sd}~wt$rB}||ur
||_Yd}~dSt|tr|j|ur
||_Yd}~dSd}~wt$r}||ur||_Yd}~dSd}~wwxYw	td#|jwxYw)Ngenerator didn't stopFz#generator didn't stop after throw())
r^rSr`closer_throw
__traceback__
isinstance	__cause__
BaseExceptionrtypvaluer$excs     rr%z!_GeneratorContextManager.__exit__s;
%TX%&'>???HNN$$$$
!


uu
}#
sE95555 
(
(
(%'''''''


%<<(1C% 55555um44!
..*3E' 55555 





e##$-!uuuuu


!"#HIII    shA(A
AA$B
DBD
D!C2%CC
D+C==DDD0N)r.r/r0r1rr%rrrr[r[}s=
0/CCC7!7!7!7!7!rr[ceZdZdZdZdZdS)_AsyncGeneratorContextManagerz*Helper for @asynccontextmanager decorator.cK|`|`|`	t|jd{VS#t
$rt
ddwxYwr])rDrErFanextrSStopAsyncIterationr`rs rr8z(_AsyncGeneratorContextManager.__aenter__sk
Ity$)	Ctx(((((((!	C	C	C788dB	Cs$?cK|`	t|jd{V	td#|jd{VwxYw#t$rYdSwxYw|
|}	|j|||d{Vn#t$r}||ucYd}~Sd}~wt$rI}||ur
||_Yd}~dSt|ttfr|j	|ur
||_Yd}~dSd}~wt$r}||ur||_Yd}~dSd}~wwxYw	td#|jd{VwxYw)NrbFz$generator didn't stop after athrow())rprSr`acloserqathrowrerfr_rgrhris     rr:z'_AsyncGeneratorContextManager.__aexit__s;
,DHoo%%%%%%%,&'>???(//++++++++++
&


uu
}#
hooc5)<<<<<<<<<<%
(
(
(%'''''''


%<<(1C% 55555u}6H&IJJ!
..*3E' 55555 





e##$-!uuuuu


("#IJJJhoo''''''''''shA0!A
A"!A"2"B
DB("D(
D5C9,C98C99
DDD!D00!EN)r.r/r0r1r8r:rrrrnrns=
54CCC7(7(7(7(7(rrnc<tfd}|S)a@contextmanager decorator.

    Typical usage:

        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        with some_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>
    c&t||SrA)r[rDrErFs  rhelperzcontextmanager.<locals>.helper+s'dD999rrrFrxs` rr	r	s364[[::::[:Mrc<tfd}|S)a@asynccontextmanager decorator.

    Typical usage:

        @asynccontextmanager
        async def some_async_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        async with some_async_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>
    c&t||SrA)rnrws  rrxz#asynccontextmanager.<locals>.helperLs,T4>>>rrrys` rrr1s364[[????[?Mrc$eZdZdZdZdZdZdS)r
a2Context to automatically close something at the end of a block.

    Code like this:

        with closing(<module>.open(<arguments>)) as f:
            <block>

    is equivalent to this:

        f = <module>.open(<arguments>)
        try:
            <block>
        finally:
            f.close()

    c||_dSrAthingrrs  rrWzclosing.__init__c



rc|jSrAr~rs rrzclosing.__enter__es
zrc8|jdSrA)rrcrexc_infos  rr%zclosing.__exit__gs
rNr.r/r0r1rWrr%rrrr
r
RsK rr
c$eZdZdZdZdZdZdS)raAsync context manager for safely finalizing an asynchronously cleaned-up
    resource such as an async generator, calling its ``aclose()`` method.

    Code like this:

        async with aclosing(<module>.fetch(<arguments>)) as agen:
            <block>

    is equivalent to this:

        agen = <module>.fetch(<arguments>)
        try:
            <block>
        finally:
            await agen.aclose()

    c||_dSrAr~rs  rrWzaclosing.__init__}rrcK|jSrAr~rs rr8zaclosing.__aenter__szrcHK|jd{VdSrA)rrsrs  rr:zaclosing.__aexit__s2j!!!!!!!!!!!rN)r.r/r0r1rWr8r:rrrrrksK""""""rrc$eZdZdZdZdZdZdS)_RedirectStreamNc"||_g|_dSrA)_new_target_old_targets)r
new_targets  rrWz_RedirectStream.__init__s%rc|jtt|jtt|j|j|jSrA)rappendrTsys_streamsetattrrrs rrz_RedirectStream.__enter__sE  dl!;!;<<<T\4#3444rcjtt|j|jdSrA)rrrrpoprexctypeexcinstexctbs    rr%z_RedirectStream.__exit__s+T\4#4#8#8#:#:;;;;;r)r.r/r0rrWrr%rrrrrsFG
   
<<<<<rrceZdZdZdZdS)raAContext manager for temporarily redirecting stdout to another file.

        # How to send help() to stderr
        with redirect_stdout(sys.stderr):
            help(dir)

        # How to write help() to a file
        with open('help.txt', 'w') as f:
            with redirect_stdout(f):
                help(pow)
    stdoutNr.r/r0r1rrrrrrs

GGGrrceZdZdZdZdS)rzCContext manager for temporarily redirecting stderr to another file.stderrNrrrrrrsMMGGGrrc$eZdZdZdZdZdZdS)ra?Context manager to suppress specified exceptions

    After the exception is suppressed, execution proceeds with the next
    statement following the with statement.

         with suppress(FileNotFoundError):
             os.remove(somefile)
         # Execution still resumes here if the file was already removed
    c||_dSrA)_exceptions)r
exceptionss  rrWzsuppress.__init__s%rcdSrArrs rrzsuppress.__enter__rc4|duot||jSrA)
issubclassrrs    rr%zsuppress.__exit__s!d"Lz'4;K'L'LLrNrrrrrrsP&&&



M
M
M
M
MrrcjeZdZdZedZedZdZdZdZ	dZ
dZd	Zd
dZ
dS)_BaseExitStackz.A base class for ExitStack and AsyncExitStack.c"t||SrArcmcm_exits  r_create_exit_wrapperz#_BaseExitStack._create_exit_wrapper'2&&&rcfd}|S)NcidSrArr"rltbrDcallbackrEs   r
_exit_wrapperz8_BaseExitStack._create_cb_wrapper.<locals>._exit_wrappersHd#d#####rrrrDrErs``` r_create_cb_wrapperz!_BaseExitStack._create_cb_wrappers.	$	$	$	$	$	$	$rc,t|_dSrA)r_exit_callbacksrs rrWz_BaseExitStack.__init__s$wwrcrt|}|j|_t|_|S)z@Preserve the context stack by transferring it to a new instance.)rUrr)r	new_stacks  rpop_allz_BaseExitStack.pop_alls0DJJLL	$($8	!$wwrct|}	|j}|||n%#t$r||YnwxYw|S)aRegisters a callback with the standard __exit__ method signature.

        Can suppress exceptions the same way __exit__ method can.
        Also accepts any object with an __exit__ method (registering a call
        to the method instead of the object itself).
        )rUr%
_push_cm_exitAttributeError_push_exit_callbackrexit_cb_typeexit_methods    rpushz_BaseExitStack.pushsu::	2"+K

t[1111		+	+	+$$T*****	+
s/AAct|}	|j}|j}n/#t$r"t	d|jd|jddwxYw||}||||S)zEnters the supplied context manager.

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        '.z6' object does not support the context manager protocolN)rUrr%r	TypeErrorr/r0rrrr+_enter_exitresults      r
enter_contextz_BaseExitStack.enter_contexts2hh	S]FLEE	S	S	SHHH1AHHHIINR
S	S2u%%%
s	 ,Ac`|j|g|Ri|}||_|||S)z\Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        )r__wrapped__rrrrDrErs     rrz_BaseExitStack.callback	sI
0/H4HHH4HH
%-
!  ///rc^|||}||ddS)z;Helper to correctly register callbacks to __exit__ methods.TN)rrrrrrs    rrz_BaseExitStack._push_cm_exits311"g>>
  55555rTc>|j||fdSrA)rr)rris_syncs   rrz"_BaseExitStack._push_exit_callbacks$##Wh$788888rN)T)r.r/r0r1staticmethodrrrWrrrrrrrrrrrs88''\'\
'''(&666
999999rrc$eZdZdZdZdZdZdS)raContext manager for dynamic management of a stack of exit callbacks.

    For example:
        with ExitStack() as stack:
            files = [stack.enter_context(open(fname)) for fname in filenames]
            # All opened files will automatically be closed at the end of
            # the with statement, even if attempts to open files later
            # in the list raise an exception.
    c|SrArrs rrzExitStack.__enter__+src
|ddu}tjd

fd}d}d}|jrf|j\}}	||rd}d}d}n6#tj}||d|dd}|}YnxYw|jf|r2	|dj}	|d#t
$r|	|d_wxYw|o|S)NrcF	|j}|||urdS|urn|}||_dSrA__context__new_excold_excexc_context	frame_excs   r_fix_exception_contextz2ExitStack.__exit__.<locals>._fix_exception_context4M
&%1&+*@*@F)++%
&#*GrFTNNNrrrrrrh)rexc_detailsreceived_excrsuppressed_exc
pending_raisercbnew_exc_details	fixed_ctxrs          @rr%zExitStack.__exit__.s8"1~T1LNN1%		*	*	*	*	* 
"
	..2244KGR

.2{#5%)N$)M"4K
."%,..&&q'9;q>JJJ $
-"
	.	
(N6	!!n$ 


-6A*
..sA1BB33Cc4|ddddSz%Immediately unwind the context stack.N)r%rs rrczExitStack.close_s

dD$'''''rN)r.r/r0r1rr%rcrrrrr sL//////b(((((rrcheZdZdZedZedZdZdZdZ	dZ
dZd	Zd
Z
dS)raAsync context manager for dynamic management of a stack of exit
    callbacks.

    For example:
        async with AsyncExitStack() as stack:
            connections = [await stack.enter_async_context(get_connection())
                for i in range(5)]
            # All opened connections will automatically be released at the
            # end of the async with statement, even if attempts to open a
            # connection later in the list raise an exception.
    c"t||SrArrs  r_create_async_exit_wrapperz)AsyncExitStack._create_async_exit_wrapperrrrcfd}|S)Nc(Kid{VdSrArrs   rrz>AsyncExitStack._create_async_cb_wrapper.<locals>._exit_wrapperxs4(D)D)))))))))))rrrs``` r_create_async_cb_wrapperz'AsyncExitStack._create_async_cb_wrappervs.	*	*	*	*	*	*	*rcKt|}	|j}|j}n/#t$r"t	d|jd|jddwxYw||d{V}||||S)zEnters the supplied async context manager.

        If successful, also pushes its __aexit__ method as a callback and
        returns the result of the __aenter__ method.
        rrzC' object does not support the asynchronous context manager protocolN)rUr8r:rrr/r0_push_async_cm_exitrs      renter_async_contextz"AsyncExitStack.enter_async_context|s2hh	'^FMEE	'	'	'UUU1AUUU"&
'	'vbzz!!!!!!  U+++
s	",Act|}	|j}|||n&#t$r||dYnwxYw|S)a#Registers a coroutine function with the standard __aexit__ method
        signature.

        Can suppress exceptions the same way __aexit__ method can.
        Also accepts any object with an __aexit__ method (registering a call
        to the method instead of the object itself).
        F)rUr:rrrrs    rpush_async_exitzAsyncExitStack.push_async_exitsw::	8",K

$$T;7777		2	2	2$$T511111	2
s/ AAcb|j|g|Ri|}||_||d|S)zfRegisters an arbitrary coroutine function and arguments.

        Cannot suppress exceptions.
        F)rrrrs     rpush_async_callbackz"AsyncExitStack.push_async_callbacksK
65hNNNNNN
%-
!  666rcDK|dddd{VdSr)r:rs rrszAsyncExitStack.acloses4nnT4...........rc^|||}||ddS)zLHelper to correctly register coroutine function to __aexit__
        method.FN)rrrs    rrz"AsyncExitStack._push_async_cm_exits577GDD
  66666rc
K|SrArrs rr8zAsyncExitStack.__aenter__srcK|ddu}tjdfd}d}d}|jrv|j\}}	|r||}n||d{V}|rd}d}d}n6#tj}	||	d|dd}|	}YnxYw|jv|r2	|dj}
|d#t
$r|
|d_wxYw|o|S)NrrcF	|j}|||urdS|urn|}||_dSrArrs   rrz8AsyncExitStack.__aexit__.<locals>._fix_exception_contextrrFTrr)rrrrrrrrcb_suppressrrrs           @rr:zAsyncExitStack.__aexit__si"1~T1LNN1%		*	*	*	*	* 
"	..2244KGR
.9"$"k"2KK(*K(8"8"8"8"8"8"8K5%)N$)M"4K
."%,..&&q'9;q>JJJ $
-#"	.$	
(N6	!!n$ 


-6A*
..sA001B#0CCN)r.r/r0r1rrrrrrrsrr8r:rrrrres

''\'\
$$///7773/3/3/3/3/rrc2eZdZdZddZdZdZdZdZdS)	raOContext manager that does no additional processing.

    Used as a stand-in for a normal context manager, when a particular
    block of code is only sometimes used with a normal context manager:

    cm = optional_cm if condition else nullcontext()
    with cm:
        # Perform operation, using optional_cm if condition is True
    Nc||_dSrAenter_result)rrs  rrWznullcontext.__init__s(rc|jSrArrs rrznullcontext.__enter__s  rcdSrArrexcinfos  rr%znullcontext.__exit__rrcK|jSrArrs rr8znullcontext.__aenter__s  rc
KdSrArrs  rr:znullcontext.__aexit__srrA)	r.r/r0r1rWrr%r8r:rrrrrsn))))!!!


!!!




rrc$eZdZdZdZdZdZdS)rzHNon thread-safe context manager to change the current working directory.c"||_g|_dSrA)path_old_cwd)rrs  rrWzchdir.__init__s	


rc|jtjtj|jdSrA)rrosgetcwdrrrs rrzchdir.__enter__s6
RY[[)))
rc\tj|jdSrA)rrrrrs  rr%zchdir.__exit__s&
""$$%%%%%rNrrrrrrsGRR&&&&&rr)#r1r4rrr'collectionsr	functoolsrtypesrr__all__ABCrr
objectrrLrQr[rnr	rr
rrrrrrrrrrrrr<module>rs::



				



********SW,#'.v.




F


 ????????0G!G!G!G!G! G!G!G!RG(G(G(G(G( G(G(G(TBB$2"""""*"""4<<<<<,<<<$




o


 oMMMMM%MMM<Q9Q9Q9Q9Q9Q9Q9Q9jA(A(A(A(A( 6A(A(A(JH/H/H/H/H/^%@H/H/H/V




(*E


6&&&&&"&&&&&r