+
    :1jS                       R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
HtHtHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHtHt ^ R	IHtHt ^ R
IHtHtHtHtHt ^ RI H!t!H"t"H#t#H$t$ ^ RI%H&t& ^ RI'H't' ^ RI(H)t) ^RI*H+t+ ])'       d   ^ RI,H-t-H.t.H/t/H0t0 ^ RIH1t1 ^ RI(H2t2 ^RI3H4t4 ^RI5H6t6 ^RI7H8t8 ^RI9H:t: ^RI;H<t<H=t= ^RI>H?t? ^RI@HAtA ]! ]B4      tC]D! ]P                  R4      ;'       d    ]P                  P                  4       tG ! R R]4      tH]6! ]P                  P                  R4      4      '       d
   ]H! R4      tKM]! R4      tKRIR  R! lltL ! R" R#4      tM ! R$ R%]M4      tN]N! 4       tO ! R& R']4      tP]]:! R(R)4      RJR* R+ ll4       4       tQ]]:! R(R)4      RKR, R- ll4       4       tR]]:! R(R)4      RLR. R/ ll4       4       tS]]PP                  ]PP                  3R0 R1 ll4       tU]R2 R3 l4       tV]R4 R5 l4       tW]RLR6 R7 ll4       tX]RR8RR3R9 R: lltYR;R/R< R= lltZ ! R> R?]
4      t[ ! R@ RA]4      t\]tRB RC lt] ! RD RE]M4      t^RF RG lt_]BRH8X  d
   ]_! 4        R# R# )MzCommon I/O utilities.)annotationsN)defaultdict)ExecutorFutureThreadPoolExecutoras_completed)contextmanager)Enum)EPIPE	ESHUTDOWN)partialwraps)BytesIOStringIO)CRITICALWARN	FormatterStreamHandler	getLogger)dirnameisdirisfilejoin)Lock)time)TYPE_CHECKING)memoizemethod)Callable	GeneratorIterableIterator)	LogRecord)Any)NullHandler)boolify)json)
deprecated)encode_environmenton_win)NULL)expandisattyc                  H   a  ] tR t^+tRtRR V 3R llltR V 3R lltRtV ;t# )DeltaSecondsFormatteraW  
Logging formatter with additional attributes for run time logging.

Attributes:
  `delta_secs`:
    Elapsed seconds since last log/format call (or creation of logger).
  `relative_created_secs`:
    Like `relativeCreated`, time relative to the initialization of the
    `logging` module but conveniently scaled to seconds as a `float` value.
c               $    V ^8  d   QhRRRRRR/# )   fmt
str | NonedatefmtreturnNone )formats   "/lib/python3.14/site-packages/conda/common/io.py__annotate__"DeltaSecondsFormatter.__annotate__7   s(     3 33 3 
	3    c                F   < \        4       V n        \        SV `  WR7       R# )zInitialize the formatter with optional format strings.

:param fmt: Log message format string.
:param datefmt: Date format string.
)r0   r2   N)r   	prev_timesuper__init__)selfr0   r2   	__class__s   &&&r7   r>   DeltaSecondsFormatter.__init__7   s     S2r:   c                    V ^8  d   QhRRRR/# )r/   recordr!   r3   strr5   )r6   s   "r7   r8   r9   D   s     & &Y &3 &r:   c                	   < \        4       pV P                  p\        V P                  V4      V n        W#,
          Vn        VP                  R ,          Vn        \        SV `  V4      # )i  )r   r<   max
delta_secsrelativeCreatedrelative_created_secsr=   r6   )r?   rC   nowr<   r@   s   &&  r7   r6   DeltaSecondsFormatter.formatD   sQ    fNN	T^^S1O'-'='='D$w~f%%r:   )r<   NN)	__name__
__module____qualname____firstlineno____doc__r>   r6   __static_attributes____classcell__r@   s   @r7   r-   r-   +   s    	3 3& &r:   r-   CONDA_TIMED_LOGGINGzm%(relative_created_secs) 7.2f %(delta_secs) 7.2f %(levelname)s %(name)s:%(funcName)s(%(lineno)d): %(message)sz<%(levelname)s %(name)s:%(funcName)s(%(lineno)d): %(message)sc               $    V ^8  d   QhRRRRRR/# )r/   iterableIterable[Any]indentintr3   rD   r5   )r6   s   "r7   r8   r8   X   s&     J J} Jc J# Jr:   c                :   a RP                  V3R lV  4       4      # )zFormat an iterable as a dashed list with optional indentation.

:param iterable: Items to format.
:param indent: Number of spaces for indentation.
:returns: Formatted string with each item on a new line prefixed by ``- ``.
 c              3  r   <"   T F,  pR RS,          ,           R,           \        V4      ,           x  K.  	  R# 5i)
 z- N)rD   ).0xrY   s   & r7   	<genexpr>dashlist.<locals>.<genexpr>_   s+     I14#,&-A66s   47)r   )rW   rY   s   &fr7   dashlistrd   X   s     77IIIIr:   c                  &    ] tR t^btRtR R ltRtR# )ContextDecoratorzqBase class for a context manager class (implementing __enter__() and __exit__()) that also
makes it a decorator.
c                    V ^8  d   QhRRRR/# r/   fCallable[..., Any]r3   r5   )r6   s   "r7   r8   ContextDecorator.__annotate__i   s      , 1C r:   c                	4   a a \        S4      VV 3R  l4       pV# )c                 f   < S;_uu_ 4        S! V / VB uuR R R 4       #   + '       g   i     R # ; iNr5   )argskwdsri   r?   s   *,r7   	decorated,ContextDecorator.__call__.<locals>.decoratedj   s!    $'$' s   0	)r   )r?   ri   rq   s   ff r7   __call__ContextDecorator.__call__i   s!    	q	( 
	( r:   r5   N)rM   rN   rO   rP   rQ   rs   rR   r5   r:   r7   rf   rf   b   s     r:   rf   c                  2    ] tR t^rtRtR R ltR R ltRtR# )SwallowBrokenPipezcIgnore BrokenPipeError and errors related to stdout or stderr being closed by a downstream program.c                   V ^8  d   QhRR/# r/   r3   r4   r5   )r6   s   "r7   r8   SwallowBrokenPipe.__annotate__u   s      4 r:   c                	    R # rn   r5   r?   s   &r7   	__enter__SwallowBrokenPipe.__enter__u   s    r:   c               (    V ^8  d   QhRRRRRRRR/# )	r/   exc_typetype[BaseException] | Noneexc_valBaseException | Noneexc_tbr"   r3   zbool | Noner5   )r6   s   "r7   r8   ry   x   s2      , & 	
 
r:   c                	    V'       dM   \        V\        4      '       d5   \        VR R4      '       d    VP                  \        \
        39   d   R# R# R# R# R# )errnoNT)
isinstanceEnvironmentErrorgetattrr   r
   r   )r?   r   r   r   s   &&&&r7   __exit__SwallowBrokenPipe.__exit__x   sL     7$455$//%!33 4 0 6 r:   r5   N)rM   rN   rO   rP   rQ   r|   r   rR   r5   r:   r7   rv   rv   r   s    m r:   rv   c                  "    ] tR t^tRtRtRtRtR# )CaptureTargetz{Constants used for contextmanager captured.

Used similarly like the constants PIPE, STDOUT for stdlib's subprocess.Popen.
r5   N)rM   rN   rO   rP   rQ   STRINGSTDOUTrR   r5   r:   r7   r   r      s    
 FFr:   r   z26.9z27.3c               (    V ^8  d   QhRRRRRRRR/# )	r/   var_mapzdict[str, str] | NonecallbackCallable[[], None] | Nonestack_callbackCallable[[bool], None] | Noner3   Generator[None, None, None]r5   )r6   s   "r7   r8   r8      s0     "" """""'"" 2"" !	""r:   c              #    "   V f   / p \        V 4      p/ pVP                  4        F>  w  rV\        P                  P	                  V\
        4      WE&   V\        P                  V&   K@  	   V'       d   V! 4        V'       d	   V! R4       Rx  VP                  4        F5  w  rVV\
        J d   \        P                  V K"  V\        P                  V&   K7  	  V'       d   V! 4        V'       d   V! R4       R# R#   TP                  4        F5  w  rVT\
        J d   \        P                  T K"  T\        P                  T&   K7  	  T'       d   T! 4        T'       d
   T! R4       i i ; i5i)a  Temporarily set environment variables.

:param var_map: Dictionary of environment variable names to values.
:param callback: Optional callback invoked when entering and exiting the context.
:param stack_callback: Optional callback invoked with True when entering, False when exiting.
NTF)r'   itemsosenvirongetr)   )r   r   r   new_var_map
saved_varsnamevalues   &&&    r7   env_varsr      s     $W-KJ"((*::>>$5
 

4 +"J4 %++-KD}JJt$#(

4 	 .
 J5!  &++-KD}JJt$#(

4 	 .
 J5! sD   A&E&)C8 1C8  C8 AE&E&,E&8AE#
E#
E##E&c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r/   r   rD   r   r   r   r   r   r3   r   r5   )r6   s   "r7   r8   r8      s:      
 ( 2	
 !r:   c              #     "   W/p\        WBVR7      ;_uu_ 4       pVx  RRR4       R#   + '       g   i     R# ; i5i)a2  Temporarily set a single environment variable.

:param name: Environment variable name.
:param value: Environment variable value.
:param callback: Optional callback invoked when entering and exiting the context.
:param stack_callback: Optional callback invoked with True when entering, False when exiting.
)r   r   Nr   )r   r   r   r   dess   &&&&  r7   env_varr      s1      
A	!~	F	F" 
G	F	F	Fs   >*
>;		>c                    V ^8  d   QhRRRR/# )r/   r   r   r3   r   r5   )r6   s   "r7   r8   r8      s      ' r:   c              #  x   "   \        V R7      ;_uu_ 4       pVx  RRR4       R#   + '       g   i     R# ; i5i)zContext manager that ensures environment variables are not modified.

:param callback: Optional callback invoked when entering and exiting the context.
)r   Nr   )r   r   s   & r7   env_unmodifiedr      s'      
8	$	$ 
%	$	$	$s   :&
:7		:c               $    V ^8  d   QhRRRRRR/# )r/   stdoutzCaptureTarget | None | Anystderrr3   zGenerator[Any, None, None]r5   )r6   s   "r7   r8   r8      s+     ^5 ^5&^5&^5  ^5r:   c              #    "   R p ! R R4      p\         P                  \         P                  rTV \        P                  8X  d8   \        4       pVP                  Vn        \        W&4      Vn        V\         n        MT pVe   V\         n        V\        P                  8X  d8   \        4       pVP                  Vn        \        W'4      Vn        V\         n        M4V\        P                  8X  d   T;\         n        pMTpVe   V\         n        V! 4       p\        P                  R4        Vx  V \        P                  8X  d   VP                  4       Vn        MWhn        V\        P                  8X  d   VP                  4       Vn        M#V\        P                  8X  d	   RVn        MWxn        WEu\         n        \         n        \        P                  R4       R#   T \        P                  8X  d   TP                  4       Tn        MYhn        T\        P                  8X  d   TP                  4       Tn        M#T\        P                  8X  d	   RTn        MYxn        YEu\         n        \         n        \        P                  R4       i ; i5i)a  Capture outputs of sys.stdout and sys.stderr.

If stdout is STRING, capture sys.stdout as a string,
if stdout is None, do not capture sys.stdout, leaving it untouched,
otherwise redirect sys.stdout to the file-like object given by stdout.

Behave correspondingly for stderr with the exception that if stderr is STDOUT,
redirect sys.stderr to stdout target and set stderr attribute of yielded object to None.

.. code-block:: pycon

   >>> from conda.common.io import captured
   >>> with captured() as c:
   ...     print("hello world!")
   ...
   >>> c.stdout
   'hello world!\n'

Args:
    stdout: capture target for sys.stdout, one of STRING, None, or file-like object
    stderr: capture target for sys.stderr, one of STRING, STDOUT, None, or file-like object

Yields:
    CapturedText: has attributes stdout, stderr which are either strings, None or the
        corresponding file-like function argument.
c                   \        V R 4      '       d   RV P                  9   d   \        pM#\        V \        4      '       d   \        pM\
        p\        W4      '       go   \        VR4      '       d%   VP                  R4      pV P                  V4       R# \        VR4      '       d%   VP                  R4      pV P                  V4       R# R# V P                  V4       R# )modebdecodezutf-8encodeN)	hasattrr   bytesr   r   rD   r   	old_writer   )r?   to_writewanteddecodedr   s   &&   r7   write_wrappercaptured.<locals>.write_wrapper   s     4  SDII%5Fg&&FF(++x**"//'2w'8,,OOG,q! - NN8$r:   c                      ] tR tRtRtR# )captured.<locals>.CapturedTexti  r5   NrM   rN   rO   rP   rR   r5   r:   r7   CapturedTextr     s    r:   r   Nzovertaking stderr and stdoutzstderr and stdout yielding back)sysr   r   r   r   r   writer   r   r   logdebuggetvalue)	r   r   r   r   saved_stdoutsaved_stderroutfileerrfilecs	   &&       r7   capturedr      s    @%(  "%SZZ,%%%*#MM7
 CJ%%%*#MM7
	=''	'&&
W CJAII,-5])))'')AHH])))'')AH}+++AHH!-
CJ		34 ])))'')AHH])))'')AH}+++AHH!-
CJ		34s    D&J)G -B,JB,JJc                    V ^8  d   QhRRRR/# )r/   	args_listz	list[str]r3   r   r5   )r6   s   "r7   r8   r8   ?  s     
 
I 
"= 
r:   c              #     "   \         P                  pV \         n         Rx  V\         n        R#   T\         n        i ; i5i)zkTemporarily replace sys.argv with the given list.

:param args_list: List of arguments to use as sys.argv.
N)r   argv)r   
saved_argss   & r7   r   r   >  s-      JCH:s   A 0 A =A c                    V ^8  d   QhRRRR/# )r/   logger_namerD   r3   r   r5   )r6   s   "r7   r8   r8   M  s     $ $ $(C $r:   c           	   #    "   \        V 4      pVP                  VP                  VP                  rCp\	        4       p\
        P                  ;_uu_ 4        VP                  V4       VP                  \        ^,           4       RRuVn        Vn        RRR4        Rx  \
        P                  ;_uu_ 4        VP                  V4       W#uVn        Vn        WAn        RRR4       R#   + '       g   i     L]; i  + '       g   i     R# ; i  \
        P                  ;_uu_ 4        TP                  T4       Y#uTn        Tn        YAn        RRR4       i   + '       g   i     i ; i; i5i)zvTemporarily disable a logger by setting its level above CRITICAL.

:param logger_name: Name of the logger to disable.
TFN)r   leveldisabled	propagater#   logging_lock
addHandlersetLevelr   removeHandler)r   logr_lvl_dsbld_prpgtnull_handlers   &     r7   disable_loggerr   L  s      [!D::t}}dnn&D=L	%hl#(,e%t~ 
$]]]|,(,%DJ#N ] 
 ]]W]]]|,(,%DJ#N ]]]sf   AE*=C%E*D E*5&C8
E*%C5	0E*8D			E*E'%&E		E'E$E''E*c               $    V ^8  d   QhRRRRRR/# )r/   r   rZ   r   r1   r3   r   r5   )r6   s   "r7   r8   r8   c  s&     $ $$$ !$r:   c           	   #  ^  "   \        V4      pVP                  VP                  VP                  VP                  3w  r4rV\        \        P                  4      pRVn        VP                  V 4       VP                  \        4       \        P                  ;_uu_ 4        VP                  V 4       . RRuVn        Vn        Vn        VP                  V4       VP                  V 4       RRR4        Rx  \        P                  ;_uu_ 4        W4VuVn        Vn        Vn        Wbn        RRR4       R#   + '       g   i     LS; i  + '       g   i     R# ; i  \        P                  ;_uu_ 4        Y4TuTn        Tn        Tn        Ybn        RRR4       i   + '       g   i     i ; i; i5i)zTemporarily set a logger to output to stderr at the given level.

:param level: Logging level (e.g., :const:`logging.INFO`).
:param logger_name: Name of the logger; if None, uses the root logger.
r   FN)r   handlersr   r   r   r   r   r   r   r   setFormatter
_FORMATTERr   r   r   )r   r   r   _hndlrsr   r   r   handlers   &&      r7   stderr_log_levelr   b  s#     [!D

	%!G6 CJJ'GGLU$	e795%4t}dn e	 

$]]]7>f4DM4:t}#N ] 
 ]]W]]]7>f4DM4:t}#N ]]]sg   BF-A
D2'F-0E 4F-E(
F-2E	=F-E		F-F*2F		F*F'"F**F-Fc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r/   r   rZ   r   r1   r   bool	formatterzFormatter | NonefilterszIterable[Any] | Noner3   r4   r5   )r6   s   "r7   r8   r8     sD     *# *#*#*# *#  	*#
 "*# 
*#r:   c                R   \        V4      p\        R VP                   4       R4      p\        \        P
                  4      pRVn        VP                  V 4       TP                  T;'       g    \        4       T;'       g    R F  pVP                  V4       K  	  \        P                  ;_uu_ 4        V'       d   VP                  V4       VP                  V4       WP                  4       8  d   VP                  V 4       W%n        RRR4       R#   + '       g   i     R# ; i)a/  Attach a new `stderr` handler to the given logger and configure both.

This function creates a new StreamHandler that writes to `stderr` and attaches it
to the logger given by `logger_name` (which maybe `None`, in which case the root
logger is used). If the logger already has a handler by the name of `stderr`, it is
removed first.

The given `level` is set **for the handler**, not for the logger; however, this
function also sets the level of the given logger to the minimum of its current
effective level and the new handler level, ensuring that the handler will receive the
required log records, while minimizing the number of unnecessary log events. It also
sets the loggers `propagate` property according to the `propagate` argument.
The `formatter` argument can be used to set the formatter of the handler.
c              3  J   "   T F  qP                   R 8X  g   K  Vx  K  	  R# 5i)r   N)r   )r`   r   s   & r7   rb   (attach_stderr_handler.<locals>.<genexpr>  s     JW1Is   #
#Nr   r5   )r   nextr   r   r   r   r   r   r   r   	addFilterr   r   r   r   getEffectiveLevelr   )	r   r   r   r   r   r   old_stderr_handlernew_stderr_handlerfilter_s	   &&&&&    r7   attach_stderr_handlerr     s    , [!DJJD
 'szz2&&##I$;$;<==b=$$W- ! 
12*+))++MM% " 
s   5ADD&	default_returnc               0    V ^8  d   QhRRRRRRRRRRR	R/# )
r/   timeout_secszint | floatfuncrj   ro   r"   r   kwargsr3   r5   )r6   s   "r7   r8   r8     sD     )" )")"
)" )" 	)"
 )" 	)"r:   c               `  a \         '       d
    V! V/ VB #  ! R R\        4      oV3R lp\        P                  ! \        P                  V4       \        P
                  ! V 4        V! V/ VB p\        P
                  ! ^ 4       V#   \         d    Tu # i ; i  S\        3 d    Tu # i ; i)a  Enforce a maximum time for a callable to complete.

Not yet implemented on Windows.

:param timeout_secs: Maximum seconds to allow the callable to run.
:param func: Callable to execute.
:param args: Positional arguments to pass to the callable.
:param default_return: Value to return if timeout or KeyboardInterrupt occurs.
:param kwargs: Keyword arguments to pass to the callable.
:returns: Return value of the callable, or ``default_return`` on timeout/interrupt.
c                      ] tR tRtRtR# )!timeout.<locals>.TimeoutExceptioni  r5   Nr   r5   r:   r7   TimeoutExceptionr     s    r:   r   c                   < S! 4       hrn   r5   )signumframer   s   &&r7   	interrupttimeout.<locals>.interrupt  s    "$$r:   )r(   KeyboardInterrupt	ExceptionsignalSIGALRMalarm)r   r   r   ro   r   r  retr   s   &&$*,  @r7   timeoutr    s    $ v	"(((
	y 		% 	fnni0\"	"''CLLOJ! ! 	"!!	"" !"34 	"!!	"s#   B (B BBB-,B-c                  N    ] tR tRtRtR R ltR R ltR R ltRR	 R
 lltRt	R# )DummyExecutori  zISynchronous executor for debugging; executes tasks in the current thread.c                   V ^8  d   QhRR/# rx   r5   )r6   s   "r7   r8   DummyExecutor.__annotate__  s     $ $$ $r:   c                	2    R V n         \        4       V n        R# )FN)	_shutdownr   _shutdownLockr{   s   &r7   r>   DummyExecutor.__init__  s    !Vr:   c               (    V ^8  d   QhRRRRRRRR/# )r/   fnrj   ro   r"   r   r3   zFuture[Any]r5   )r6   s   "r7   r8   r    s)      + C 3 ; r:   c                	@   V P                   ;_uu_ 4        V P                  '       d   \        R 4      h\        4       p V! V/ VB pVP	                  V4       VuuRRR4       #   \
         d   pTP                  T4        Rp?L-Rp?ii ; i  + '       g   i     R# ; i)z*cannot schedule new futures after shutdownN)r  r  RuntimeErrorr   
set_resultBaseExceptionset_exception)r?   r  ro   r   ri   resultes   &&*,   r7   submitDummyExecutor.submit  s    ~~~"#OPPA%T,V, V$   ! #""#  s4   (BA#B#B	.B?BB		BB	c               $    V ^8  d   QhRRRRRR/# )r/   r   rj   	iterablesrX   r3   zIterator[Any]r5   )r6   s   "r7   r8   r    s(     " " " "" 
	"r:   c              '  F   "   V F  pV F  pV! V4      x  K  	  K  	  R# 5i)z<Map function over iterables, yielding results one at a time.Nr5   )r?   r   r   rW   things   &&*  r7   mapDummyExecutor.map  s%      "H!5k! " "s   !c                    V ^8  d   QhRRRR/# )r/   waitr   r3   r4   r5   )r6   s   "r7   r8   r    s     " "T "T "r:   c                	v    V P                   ;_uu_ 4        R V n        RRR4       R#   + '       g   i     R# ; i)TN)r  r  )r?   r&  s   &&r7   shutdownDummyExecutor.shutdown  s$    !DN  s   '8	)r  r  N)T)
rM   rN   rO   rP   rQ   r>   r  r#  r(  rR   r5   r:   r7   r  r    s    S$"" "r:   r  c                  H   a  ] tR tRtRtRR V 3R llltR V 3R lltRtV ;t# )	ThreadLimitedThreadPoolExecutori  zDThread pool executor that gracefully handles thread creation limits.c                    V ^8  d   QhRRRR/# )r/   max_workersrZ   r3   r4   r5   )r6   s   "r7   r8   ,ThreadLimitedThreadPoolExecutor.__annotate__  s     & &C & &r:   c                	&   < \         SV `  V4       R # rn   )r=   r>   )r?   r-  r@   s   &&r7   r>   (ThreadLimitedThreadPoolExecutor.__init__  s    %r:   c                   V ^8  d   QhRR/# rx   r5   )r6   s   "r7   r8   r.  	  s      d r:   c                	|   <  \         SV `  4       #   \         d     \        T P                  4      ^ 8  d    R# h i ; i)    N)r=   _adjust_thread_countr  len_threads)r?   r@   s   &r7   r4  4ThreadLimitedThreadPoolExecutor._adjust_thread_count	  s@    
	7/11 	 4==!A% 	s    %;;r5   )
   )	rM   rN   rO   rP   rQ   r>   r4  rR   rS   rT   s   @r7   r+  r+    s    N& & r:   r+  c                   V ^8  d   QhRR/# )r/   r3   rD   r5   )r6   s   "r7   r8   r8     s       r:   c                 n    \        RRR4      p \        \        P                  P	                  RV 4      4      # )zReturn the path to the instrumentation record file.

:returns: Expanded path from ``CONDA_INSTRUMENTATION_RECORD_FILE`` or default location.
~z.condazinstrumentation-record.csv!CONDA_INSTRUMENTATION_RECORD_FILE)r   r*   r   r   r   )default_record_files    r7   get_instrumentation_record_filer>    s5    
 sH.JK


:<OP r:   c                     a  ] tR tRt$ Rt]! 4       tRtR]R&   ]	! ]
4      tR]R&   ]	! ]4      tR]R	&   RR
 R lltR R ltR V 3R lltR R ltR R lt]R R l4       t]R R l4       tRtV ;t# )time_recorderi%  z>Context decorator for recording execution times to a CSV file.Nzfloat | None
start_timezdict[str, int]total_call_numzdict[str, float]total_run_timec               $    V ^8  d   QhRRRRRR/# )r/   
entry_namer1   module_namer3   r4   r5   )r6   s   "r7   r8   time_recorder.__annotate__-  s(     ' ''  ' 
	'r:   c                	    Wn         W n        R # rn   )rE  rF  )r?   rE  rF  s   &&&r7   r>   time_recorder.__init__-  s    
 %&r:   c                    V ^8  d   QhRRRR/# )r/   ri   rj   r3   r4   r5   )r6   s   "r7   r8   rG  5  s     ) )!3 ) )r:   c                	    V P                   fj   \        VR4      '       d   VP                  pMRVP                  ,           pV P                  '       d   RP                  V P                  V34      pW n         R # R # )NrO   :.)rE  r   rO   rM   rF  r   )r?   ri   rE  s   && r7   _set_entry_nametime_recorder._set_entry_name5  s_    ??"q.))^^
 1::-
 XXt'7'7&DE
(O #r:   c                    V ^8  d   QhRRRR/# rh   r5   )r6   s   "r7   r8   rG  ?  s     # #, #1C #r:   c                	D   < V P                  V4       \        SV `	  V4      # rn   )rN  r=   rs   )r?   ri   r@   s   &&r7   rs   time_recorder.__call__?  s!    Qw""r:   c                   V ^8  d   QhRR/# )r/   r3   r@  r5   )r6   s   "r7   r8   rG  C  s      = r:   c                	    \         P                  P                  R 4      pV'       d!   \        V4      '       d   \	        4       V n        V # )CONDA_INSTRUMENTATION_ENABLED)r   r   r   r$   r   rA  )r?   enableds   & r7   r|   time_recorder.__enter__C  s0    **..!@Aww''"fDOr:   c               (    V ^8  d   QhRRRRRRRR/# )	r/   r   r   r   r   r   r"   r3   r4   r5   )r6   s   "r7   r8   rG  I  s2     9 9,9 &9 	9
 
9r:   c                	   V P                   '       d   V P                  p\        4       pWPP                   ,
          pV P                  V;;,          ^,          uu&   V P                  V;;,          V,          uu&   V P                  4        \        V P                  R4      ;_uu_ 4       pVP                  V RVR R24       RRR4       R# R#   + '       g   i     R# ; i)   a,ri   r^   N)	rA  rE  r   rB  rC  _ensure_diropenrecord_filer   )r?   r   r   r   rE  end_timerun_timefhs   &&&&    r7   r   time_recorder.__exit__I  s     ???JvH//1H
+q0+
+x7+d&&,,J<q!B78 -,  -,,s   'CC	c                   V ^8  d   QhRR/# rx   r5   )r6   s   "r7   r8   rG  ]  s      4 r:   c                	l   \         P                  P                  R 4      pV'       d   \        V4      '       g   R# \        P                  R4       \        V P                  P                  4       4       F=  p\        P                  RV P                  V,          V P                  V,          V4       K?  	  R# )rU  Nz*=== time_recorder total time and calls ===zTOTAL %9.3f % 9d %s)
r   r   r   r$   r   infosortedrC  keysrB  )clsrV  rE  s   &  r7   
log_totalstime_recorder.log_totals\  s~    **..!@AGG,,=> !3!3!8!8!:;JHH%"":."":.	 <r:   c                   V ^8  d   QhRR/# rx   r5   )r6   s   "r7   r8   rG  k  s     3 3T 3r:   c                	    \        \        V P                  4      4      '       g,   \        P                  ! \        V P                  4      4       R # R # rn   )r   r   r_  r   makedirsr{   s   &r7   r]  time_recorder._ensure_dirj  s4    WT--.//KK 0 012 0r:   )rE  rF  rA  rL   )rM   rN   rO   rP   rQ   r>  r_  rA  __annotations__r   rZ   rB  floatrC  r>   rN  rs   r|   r   classmethodrj  r   r]  rR   rS   rT   s   @r7   r@  r@  %  s}    H13K#J#%0%5NN5'25'9N$9')# #9&   3 3r:   r@  c                   V ^8  d   QhRR/# rx   r5   )r6   s   "r7   r8   r8   p  s     T TD Tr:   c            	        \        4       p \        \        4      p/ p\        V 4      '       g   R# \	        V 4      ;_uu_ 4       pV FD  pVP                  4       P                  R4      w  rVW,          P                  \        V4      4       KF  	  RRR4       \        V4       F3  pW,          p\        V4      p\        V4      pWh,          p	RVRVRV	/W%&   K5  	  \        \        P                  ! VR^RR7      4       R#   + '       g   i     Lw; i)	zCPrint aggregated instrumentation data from the record file as JSON.Nr\  counts
total_timeaverage_timeT)	sort_keysrY   
separators)r\  z: )r>  r   listr   r^  stripsplitappendrq  rg  r5  sumprintr%   dumps)
r_  grouped_data
final_datarb  linerE  rv  	all_timesru  rw  s
             r7   print_instrumentation_datar  p  s    13Kt$LJ+	k		bD%)ZZ\%7%7%<"J$++E*,=>  

 \*
 ,	Y^
!*f*L"

 + 
$**Z4k
RS! 
	s   AC<<D	__main__)r/   )NNNrL   rn   )`rQ   
__future__r   r   r   r  r   collectionsr   concurrent.futuresr   r   r   r   
contextlibr   enumr	   r   r
   r   	functoolsr   r   ior   r   r   r   r   r   r   os.pathr   r   r   r   	threadingr   r   typingr   auxlib.decoratorsr   collections.abcr   r   r   r    r!   r"   auxlib.logzr#   auxlib.type_coercionr$   common.serializer%   deprecationsr&   compatr'   r(   	constantsr)   pathr*   rM   r   r   r   r+   IS_INTERACTIVEr-   r   r   r   rd   rf   rv   swallow_broken_piper   r   r   r   r   r   r   r   r   r   r  r  r+  r>  r@  r  r5   r:   r7   <module>r     s_    "  	  
 # Q Q %  " $   G G 0 0     -GG! % * # % .  X.FF3::3D3D3F&I &D 2::>>/011&	GJ
 FJ
J  ( * () D  FF""  ""J FF  $ FF   )6)=)=)6)=)=^5 ^5B 
 
 $ $* $ $D ""&$(*#Z)" 	)"Z""H ""J&8 ( H3$ H3VT: z  r:   