
    Mh                     f   d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
 ddlmZ g d ee          z   Zi Zi Zd Zd	 Zd
 Zd Zd ZddZd Z G d dej                  Zej        e         Z ee          Zej                            ej                   eej        e<   e`e`e`e`dS )z
    pygments.formatters
    ~~~~~~~~~~~~~~~~~~~

    Pygments formatters.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)basename)
FORMATTERS)find_plugin_formatters)ClassNotFound)get_formatter_by_nameget_formatter_for_filenameget_all_formattersload_formatter_from_filec                     |t           vrEt          j        t          j        |                    x}t           |<   |                    |           S t           |                             |           S )zBReturn whether the supplied file name fn matches pattern filename.)_pattern_cacherecompilefnmatch	translatematch)fnglobpatterns      \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pygments/formatters/__init__.py_fn_matchesr      s\    >!!)+G4Ed4K4K)L)LL.&}}R   $%%b)))    c                 ~    t          | dddg          }|j        D ]!}t          ||          }|t          |j        <   "dS )z4Load a formatter (and all others in the module too).N__all__)
__import__r   getattr_formatter_cachename)module_namemodformatter_nameclss       r   _load_formattersr"   $   sQ    
[$yk
:
:C+ ) )c>**%("") )r   c               #      K   t          j                    D ];} | d         t          vrt          | d                    t          | d                  V  <t	                      D ]	\  }}|V  
dS )z-Return a generator for all formatter classes.   r   N)r   valuesr   r"   r   )info_	formatters      r   r	   r	   ,   s       !## ( (7***T!W%%%tAw'''''.00  9 r   c                     t          j                    D ]3\  }}}}}| |v r'|t          vrt          |           t          |         c S 4t	                      D ]\  }}| |j        v r|c S dS )zALookup a formatter by alias.

    Returns None if not found.
    N)r   r%   r   r"   r   aliases)aliasr   r   r*   r'   r!   s         r   find_formatter_classr,   7   s    
 -7,=,?,? * *(T7AqG+++ ---#D))))  )**  3CKJJJ   r   c                 X    t          |           }|t          d|            |di |S )a  
    Return an instance of a :class:`.Formatter` subclass that has `alias` in its
    aliases list. The formatter is given the `options` at its instantiation.

    Will raise :exc:`pygments.util.ClassNotFound` if no formatter with that
    alias is found.
    Nzno formatter found for name  )r,   r   )_aliasoptionsr!   s      r   r   r   F   s?     v
&
&C
{E6EEFFF3>>>>r   CustomFormatterc                    	 i }t          | d          5 }t          |                                |           ddd           n# 1 swxY w Y   ||vrt          d| d|            ||         } |di |S # t          $ r}t          d|  d|           d}~wt          $ r  t
          $ r}t          d|           d}~ww xY w)	a#  
    Return a `Formatter` subclass instance loaded from the provided file, relative
    to the current directory.

    The file is expected to contain a Formatter class named ``formattername``
    (by default, CustomFormatter). Users should be very careful with the input, because
    this method is equivalent to running ``eval()`` on the input file. The formatter is
    given the `options` at its instantiation.

    :exc:`pygments.util.ClassNotFound` is raised if there are any errors loading
    the formatter.

    .. versionadded:: 2.2
    rbNz	no valid z class found in zcannot read z: z%error when loading custom formatter: r.   )openexecreadr   OSError	Exception)filenameformatternamer0   custom_namespacefformatter_classerrs          r   r
   r
   T   sZ   K(D!! 	-Q+,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-  000 UM U U8 U UVVV*=9))))) > > ><8<<s<<===    K K KICIIJJJKsE   A7 #AA7 AA7 
A+A7 7
CBC-B??Cc                 v   t          |           } t          j                    D ]K\  }}}}}|D ]@}t          | |          r.|t          vrt          |           t	          |         di |c c S ALt                      D ]+\  }}|j        D ]}t          | |          r |di |c c S ,t          d|           )a  
    Return a :class:`.Formatter` subclass instance that has a filename pattern
    matching `fn`. The formatter is given the `options` at its instantiation.

    Will raise :exc:`pygments.util.ClassNotFound` if no formatter for that filename
    is found.
    z!no formatter found for file name Nr.   )	r   r   r%   r   r   r"   r   	filenamesr   )	r   r0   modnamer   r'   r@   r9   _namer!   s	            r   r   r   v   s    
"B*4*;*=*= 9 9&q)Q! 	9 	9H2x(( 9///$W---'-8888888889	9
 -.. & &
s 	& 	&H2x(( &s~~W~~%%%%%&	& BBBB
C
CCr   c                       e Zd ZdZd ZdS )_automodulez Automatically import formatters.c                     t          j        |          }|r;t          |d                    t          |d                  }t	          | ||           |S t          |          )Nr   r$   )r   getr"   r   setattrAttributeError)selfr   r&   r!   s       r   __getattr__z_automodule.__getattr__   s^    ~d## 	T!W%%%"47+CD$$$$JT"""r   N)__name__
__module____qualname____doc__rJ   r.   r   r   rD   rD      s)        **# # # # #r   rD   )r1   ) rN   r   systypesr   os.pathr   pygments.formatters._mappingr   pygments.pluginr   pygments.utilr   listr   r   r   r   r"   r	   r,   r   r
   r   
ModuleTyperD   modulesrK   oldmodnewmod__dict__updater.   r   r   <module>r\      s    
			 



         3 3 3 3 3 3 2 2 2 2 2 2 ' ' ' ' ' '= = =?CtJ?O?OP  * * *) ) )      K K K KDD D D,
# 
# 
# 
# 
#%" 
# 
# 
# 
X		X		   v ' ' 'H 
M6=&*flllr   