
    uki[                    f   d dl mZ d dlmZ d dlmZ d dlZd dlmZ d dl	m
Z
 d dlmZ  e
j                  dd	d
      ZddZ e       Zej"                  Zej$                  Zej&                  Z	 ddddd	 	 	 	 	 	 	 	 	 ddZee_        d e_        ej.                  Zej0                  Zej2                  Zej4                  Zej6                  Zej8                  Zej:                  Zej<                  Z eeej>                  ej@                        Z! eeejD                  ejF                        Z$ddZ%y)    )annotations)Sequence)partialN)Any)config)_pretty_printerjax_pprint_use_colorTz?Enable jaxpr pretty-printing with colorful syntax highlighting.)helpc                    	 t               } | j                  j                  }|dk(  rydt        | j                        v ry	 t        t        j                  d      xr t        j                  j                         S # t        $ r Y Ew xY w)NZMQInteractiveShellTcolabisatty)	get_ipython	__class____name__str	NameErrorhasattrsysstdoutr   )ipythonshells     R/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/_src/pretty_printer.py_can_use_colorr   -   s    	mG&&E%%	C))*	* 
+ 
X	&	>3::+<+<+>> 
 		s   %A; A; ;	BBz # 	use_colorannotation_prefix
source_mapc               `    |t         xr t        j                  }| j                  ||||      S )z
  Formats a pretty-printer document as a string.

  Args:
  source_map: for each line in the output, contains a list of
    (start column, end column, source) tuples. Each tuple associates a
    region of output text with a source.
  r   )CAN_USE_COLOR_PPRINT_USE_COLORvalue_format)selfwidthr   r   r   s        r   r#   r#   C   s<     9"3"9"9I	y4E 
 
     c                "    | j                         S )N)format)r$   s    r   <lambda>r)   V   s    4;;= r&   )	intensity
foregroundc                    t        |      }t        |      dk(  r
t               S t        |      dk(  r|d   S |d   g}|dd D ]$  }|j                  |        |j                  |       & t	        |      S )z(Concatenates `docs`, separated by `sep`.r      N)listlennilappendconcat)sepdocsxsdocs       r   joinr7   g   ss    	d$Y!^5LY!^7NQy"!"X cIIcNIIcN 
r&   )returnbool)P   )
r%   intr   zbool | Noner   r   r   z'list[list[tuple[int, int, Any]]] | Noner8   r   )r3   Docr4   zSequence[Doc]r8   r<   )&
__future__r   collections.abcr   	functoolsr   r   typingr   jax._srcr   jax._src.libr   
bool_stater!   r   r    Color	Intensityr<   r#   r(   __str__r0   textr2   brkgroupnestcolorr   NORMALMAGENTAtype_annotationBRIGHTBLUEkeywordr7    r&   r   <module>rS      sP  8 # $  
   ; &F%%	J ?   %%	 59 8<'2 6 		$ 
(			''
 %9+;+;%*]]4
%9#3#3


Kr&   