
    )i                     x   S r SSKrSSKrSSKrSSKrSSKJr  SSKJr  SSK	J
r
  SSKJr  / SQ\" \5      -   r0 r0 rS rS	 rS
 rS rS rSS jrS r " S S\R0                  5      r\R4                  \   r\" \5      r\R<                  R?                  \R<                  5        \\R4                  \'   \?\?\?\?g)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                     U[         ;  aD  [        R                  " [        R                  " U5      5      =n[         U'   UR                  U 5      $ [         U   R                  U 5      $ )zBReturn whether the supplied file name fn matches pattern filename.)_pattern_cacherecompilefnmatch	translatematch)fnglobpatterns      \/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/pygments/formatters/__init__.py_fn_matchesr      sR    >!)+G4E4Ed4K)LL.&}}R  $%%b))    c                     [        U SSS/5      nUR                   H!  n[        X5      nU[        UR                  '   M#     g)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"   $   s;    
[$yk
:C++c*%(" &r   c               #      #    [         R                  " 5        H,  n U S   [        ;  a  [        U S   5        [        U S      v   M.     [	        5        H	  u  pUv   M     g7f)z-Return a generator for all formatter classes.   r   N)r   valuesr   r"   r   )info_	formatters      r   r	   r	   ,   sX      !!#7**T!W%tAw'' $ /0 1s   AA c                     [         R                  " 5        H-  u  pn  nX;   d  M  U[        ;  a  [        U5        [        U   s  $    [	        5        H  u  pEXR
                  ;   d  M  Us  $    g)z9Lookup 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   sc    
 -7,=,=,?(7Aq++ -#D))	 -@
 )*KKJ +r   c                 L    [        U 5      nUc  [        SU < 35      eU" S0 UD6$ )z
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.
zno formatter found for name  )r,   r   )_aliasoptionsr!   s      r   r   r   F   s2     v
&C
{:6*EFF>>r   c                 \    0 n[        U S5       n[        UR                  5       U5        SSS5        X;  a  [        SU SU  35      eX1   nU" S0 UD6$ ! , (       d  f       N0= f! [         a  n[        SU  SU 35      eSnAf[         a    e [
         a  n[        SU 35      eSnAff = f)	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   s    K(D!Q+, " 0)M?:J8* UVV*9))) "!  >l8*Bse<==  KCC5IJJKs9   A& A)A& 
A#A& &
B+0BB+B&&B+c                 |   [        U 5      n [        R                  " 5        HH  u  p#pEnU H;  n[        X5      (       d  M  U[        ;  a  [        U5        [        U   " S0 UD6s  s  $    MJ     [        5        H4  u  pxUR                   H  n[        X5      (       d  M  U" S0 UD6s  s  $    M6     [        SU < 35      e)z
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 r.   )	r   r   r%   r   r   r"   r   	filenamesr   )	r   r0   modnamer   r'   r?   r8   _namer!   s	            r   r   r   v   s     
"B*4*;*;*=&qQ!H2((//$W-'-888	 " +> -.
H2((~W~% & / ;B6B
CCr   c                       \ rS rSrSrS rSrg)_automodule   z Automatically import formatters.c                     [         R                  " U5      nU(       a(  [        US   5        [        US      n[	        XU5        U$ [        U5      e)Nr   r$   )r   getr"   r   setattrAttributeError)selfr   r&   r!   s       r   __getattr___automodule.__getattr__   sG    ~~d#T!W%"47+CD$JT""r   r.   N)__name__
__module____qualname____firstlineno____doc__rJ   __static_attributes__r.   r   r   rC   rC      s
    *#r   rC   )CustomFormatter) rP   r   systypesr   os.pathr   pygments.formatters._mappingr   pygments.pluginr   pygments.utilr   listr   r   r   r   r"   r	   r,   r   r
   r   
ModuleTyperC   modulesrL   oldmodnewmod__dict__updater.   r   r   <module>r`      s    
 
    3 2 '=?CJ?OP  *)KDD,
#%"" 
# 
X		X	   v 'H 
M6=&*flr   