kghS/dZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZdd d d Zgd eezeezZiZiZd ZdZddZdZdZdZddZd dZd dZdZddZdZ dZ!Gddej"Z#ej$e%Z&e#e%Z'e'j()e&j(e'ej$e%<e'`'e'`&e'`e'`dS)!z pygments.lexers ~~~~~~~~~~~~~~~ Pygments lexers. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N)basename)LEXERS)get_filetype_from_buffer)find_plugin_lexers) ClassNotFound guess_decode PythonLexerPythonTracebackLexer Lean3Lexer) Python3LexerPython3TracebackLexer LeanLexer)get_lexer_by_nameget_lexer_for_filenamefind_lexer_class guess_lexerload_lexer_from_filec|tvrEtjtj|x}t|<||St||S)zBReturn whether the supplied file name fn matches pattern filename.)_pattern_cacherecompilefnmatch translatematch)fnglobpatterns /builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/pygments/lexers/__init__.py _fn_matchesr#s\ >!!)+G4Ed4K4K)L)LL.&}}R   $  % %b ) ))c~t|dddg}|jD]!}t||}|t|j<"dS)z0Load a lexer (and all others in the module too).N__all__) __import__r"getattr _lexer_cachename) module_namemod lexer_nameclss r _load_lexersr++sP [$yk : :Ck%% c:&&!$ SX%%r Tc#KtjD]}|ddV|r-tD] }|j|j|j|jfVdSdS)aReturn a generator of tuples in the form ``(name, aliases, filenames, mimetypes)`` of all know lexers. If *plugins* is true (the default), plugin lexers supplied by entrypoints are also returned. Otherwise, only builtin ones are considered. N)rvaluesrr&aliases filenames mimetypes)pluginsitemlexers rget_all_lexersr53s 122hN')) N NE*emU_eoM M M M MNN N Nr c|tvr t|StjD],\}}}}}||krt|t|cS-t D]}|j|kr|cSdS)zi Return the `Lexer` subclass that with the *name* attribute as given by the *name* argument. N)r%rr.r+rr&)r&r'lnamer/_r*s rrrAs  |D!!-3]__&&) UGQ 5==  % % %% % % % "## 8t  JJJ r cd|std|dtjD]E\}}}}}||vr'|tvrt |t|cSFt D]!}||jvr|cS"td|d)a$ Return the `Lexer` subclass that has `alias` in its aliases list, without instantiating it. Like `get_lexer_by_name`, but does not instantiate the class. Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is found. .. versionadded:: 2.2 no lexer for alias  foundrrr.lowerr%r+rr/)_aliasr'r&r/r8r*s rfind_lexer_class_by_namer?Ss DB&BBBCCC,2MOO&&( T7Aq <<>>W $ $<''[)))% % % % % "## <<>>S[ ( (JJJ ) >f>>> ? ??r c z|std|dtjD]J\}}}}}||vr,|tvrt |t |di|cSKt D]'}||jvr |di|cS(td|d)z Return an instance of a `Lexer` subclass that has `alias` in its aliases list. The lexer is given the `options` at its instantiation. Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is found. r:r;Nr<)r>optionsr'r&r/r8r*s rrrns DB&BBBCCC-3MOO11( T7Aq <<>>W $ $<''[)))%0000 0 0 0 % "##"" <<>>S[ ( (3>>>> ! ! ! ) >f>>> ? ??r CustomLexerc  i}t|d5}t||dddn #1swxYwY||vrtd|d|||}|di|S#t$r}td|d|d}~wt$rt $r}td|d}~wwxYw) aLoad a lexer from a file. This method expects a file located relative to the current working directory, which contains a Lexer class. By default, it expects the Lexer to be name CustomLexer; you can specify your own class name as the second argument to this function. Users should be very careful with the input, because this method is equivalent to running eval on the input file. Raises ClassNotFound if there are any problems importing the Lexer. .. versionadded:: 2.2 rbNz no valid z class found in z cannot read z: z!error when loading custom lexer: rA)openexecreadrOSError Exception)filename lexernamerBcustom_namespacef lexer_classerrs rrrsZG (D ! ! -Q + , , , - - - - - - - - - - - - - - - , , , QI Q Qx Q QRR R&y1 {%%W%%% >>><8<.get_ratings_ X8#+0q  @##D))E13<? ?|e#S\11r keyrN) rrr.rr%r+appendrr0 isinstancebytesrsort) _fnrYmatchesrmodnamer&r8r0rKr*rZs ` rfind_lexer_class_for_filenameresWG #B*0-//??&q)Q! ? ?H2x(( ?|++ ))) T 2H=>>>  ? "##00  0 0H2x(( 0X/// 0$"D!! 2 2 2 2 2  $$$r{1~r c \t||}|std|d|di|S)aGet a lexer for a filename. Return a `Lexer` subclass instance that has a filename pattern matching `fn`. The lexer is given the `options` at its instantiation. Raise :exc:`pygments.util.ClassNotFound` if no lexer for that filename is found. If multiple lexers match the filename pattern, use their ``analyse_text()`` methods to figure out which one is more appropriate. no lexer for filename r;rA)rer)rbrYrBress rrrsH (T 2 2C DBSBBBCCC 3>>>>r c tjD]8\}}}}}||vr,|tvrt|t|di|cS9t D]}||jvr |di|cSt d|d)z Return a `Lexer` subclass instance that has `mime` in its mimetype list. The lexer is given the `options` at its instantiation. Will raise :exc:`pygments.util.ClassNotFound` if not lexer for that mimetype is found. zno lexer for mimetype r;NrA)rr.r%r+rr1r)_mimerBrdr&r8r1r*s rget_lexer_for_mimetyperks+1-//11&q!Y I  <''W%%%%0000 0 0 0 "##"" CM ! !3>>>> ! ! ! " @@@@ A AAr c#KttD]A}t|dd\}}|tvrt|t|VB|rt Ed{VdSdS)z*Return an iterator over all lexer classes.N)sortedrr%r+r)r2r\r'r&s r_iter_lexerclassesrosf~~!!"3KO T | # #  % % %4     (%'''''''''''((r c  t|}i t}tD]j}|jD],}t ||r||d |<-|jD],}t ||r||d |<-k|std|dt|dkr| d i|Sg}|D]>}| |}|dkr |d i|cS| ||f? fd} | | |d dd i|S) a  As :func:`guess_lexer()`, but only lexers which have a pattern in `filenames` or `alias_filenames` that matches `filename` are taken into consideration. :exc:`pygments.util.ClassNotFound` is raised if no lexer thinks it can handle the content. TFrgr;r-?c`|d|d|dj|djfSNrr-)rVrU)tprimarys r type_sortz+guess_lexer_for_filename..type_sort$s, !gadmQqT]AaDMBBr r[r]rA) rsetror0raddalias_filenamesrlenpoprTr^ra) rb_textrBrmatching_lexersr4rKresultrvrvrus @rguess_lexer_for_filenamers #BGeeO#%%'' & &H2x(( &##E***!%- ' 'H2x(( '##E***!& ' CARAAABBB ?q  $""$$//w/// F ##    & & 995##7## # # # r5k""""CCCCC KKIK 6":a= # #7 # ##r c ,t|tsU|d|d}|r||pd}nt |\}}t |}| t |fi|S#t$rYnwxYwddg}tD]<}| |}|dkr |d i|cS||dkr ||f|dd<=|dr|dtd |dd i|S) a Return a `Lexer` subclass instance that's guessed from the text in `text`. For that, the :meth:`.analyse_text()` method of every known lexer class is called with the text as argument, and the lexer which returned the highest value will be instantiated and returned. :exc:`pygments.util.ClassNotFound` is raised if no lexer thinks it can handle the content. inencodingencodingutf8Ngrqrr-z no lexer matching the text foundrA) r_strgetdecoderrrrrorT)r|rBrr8ft best_lexerr4rs rrr0sm eS ! !+[[w{{:/F/FGG  +LL!5v66EE#E**HE1 "% ( (B ~ $R33733 3    D tJ#%%((    & & 995##7## # # # 1  KJqqqM a=@JqM1>??? :a= # #7 # ##s= B BBceZdZdZdZdS) _automodulezAutomatically import lexers.c tj|}|r;t|dt|d}t ||||S|t vrt |t |St|rs)rrr+r%setattrCOMPATr$AttributeError)selfr&rWr*s r __getattr__z_automodule.__getattr__Zs{z$   a ! ! !tAw'C D$ $ $ $J 6>>4.. .T"""r N)rU __module__ __qualname____doc__rrAr rrrWs)&& # # # # #r r)T)rC)N)*rrsystypesros.pathr$pip._vendor.pygments.lexers._mappingrpip._vendor.pygments.modelinerpip._vendor.pygments.pluginrpip._vendor.pygments.utilrrrlistr"r%rrr+r5rr?rrrerrkrorr ModuleTypermodulesrUoldmodnewmod__dict__updaterAr rrs_ 777777BBBBBB::::::AAAAAAAA"3    2 2 248DLL ACG4<< P ***%%% N N N N$@@@6@@@2GGGGD((((V&BBB&((((($($($V$$$$$$N # # # # #%" # # # X  X  v''' H M6=&*flllr