o
    Xi                     @  s8   d Z ddlmZ ddlmZ dddZG dd	 d	Zd
S )zInternal utilities for displaying the intermediate representation of a model.

NOTE: All third-party imports should be scoped and imported only when used to avoid
importing unnecessary dependencies.
    )annotations)Anyreturnr   c                  C  s$   zddl } W | S  ty   Y dS w )z.Raise an ImportError if rich is not installed.r   N)richImportError)r    r   D/home/ubuntu/.local/lib/python3.10/site-packages/onnx_ir/_display.pyrequire_rich   s   
r	   c                   @  s   e Zd Zddd
ddZd	S )PrettyPrintableF)pager   boolr   Nonec                C  s   t  }t| }|du rt| td| jj d dS ddl}|j|}|rLddl}|j	
 }|  || W d   dS 1 sEw   Y  dS || dS )z^Pretty print the object.

        Args:
            page: Whether to page the output.
        NzR

[36mTip: Install the rich library with 'pip install rich' to pretty print this z.[0mr   )r	   strprint	__class____name__rich.markupmarkupescaperich.consoleconsoleConsolepager)selfr   r   textr   r   r   r   display   s"   

"zPrettyPrintable.displayN)r   r   r   r   )r   
__module____qualname__r   r   r   r   r   r
      s    r
   N)r   r   )__doc__
__future__r   typingr   r	   r
   r   r   r   r   <module>   s
   
	