i7i-fdZddlZddlmZmZmZmZmZmZm Z m Z m Z ddl m Z mZddlmZmZmZmZmZmZmZmZmZmZmZmZddlmZgdZGdd eZ e Z!Gd d eZ"Gd d eZ#GddeZ$GddeZ%e%Z&GddeZ'GddeZ(GddeZ)Gdde Z*y)z pygments.lexers.python ~~~~~~~~~~~~~~~~~~~~~~ Lexers for Python and related languages. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N) DelegatingLexer RegexLexerincludebygroupsusingdefaultwordscombinedthis) get_bool_optshebang_matches) TextCommentOperatorKeywordNameStringNumber PunctuationGenericOtherError Whitespace) unistring) PythonLexerPythonConsoleLexerPythonTracebackLexer Python2LexerPython2TracebackLexer CythonLexerDgLexer NumPyLexerc"eZdZdZdZdZgdZgdZgdZdZ de jd e jd Z d Zd Zid defdeeej&ej(fdeeej&ej(fdej,fdej.fdefdefededdeeedfdeeedfdeej6edfdeej6edfedgdd eej&ej8ed!d"fd#eej&ej.ed!d$fd%eej&ej8ed!d&fd'eej&ej.ed!d(fd)eej&ej8ed*d"fd+eej&ej.ed*d$fd,eej&ej8ed*d&fd-eej&ej.ed*d(fd.eej&ej8d/fd0eej&ej.d1fd2eej&ej8d3fd4eej&ej.d5fd6eej&ej8ed7d/fd8eej&ej.ed7d1fd9eej&ej8ed7d3fd:eej&ej.ed7d5fd;eej&ej8edeej&ej8ed=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}z [^\\\'"%{\n]+[\'"\\]z %|(\{{1,2})rInterpolttypes _/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/pygments/lexers/python.pyinnerstring_ruleszPythonLexer.innerstring_rulesAsJ'(. 9OO  %u %   U #  cXdtjfdtjdfd|fd|fgS)Nz\}z\{expr-inside-fstringz [^\\\'"{}\n]+r6r7r9s r; fstring_ruleszPythonLexer.fstring_rulesUs9 FOO $ FOO%: ; u %    r=root\n&^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")&^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')\A#!.+$#.*$\\\n\\keywordsz soft-keywords(def)((?:\s|\\\s)+)funcname(class)((?:\s|\\\s)+) classname(from)((?:\s|\\\s)+) fromimport(import)((?:\s|\\\s)+)importexprz(?i)(rf|fr)(""")rfstringescapetdqfz(?i)(rf|fr)(''')tsqfz(?i)(rf|fr)(")dqfz(?i)(rf|fr)(')sqfz ([fF])(""") fstringescapez ([fF])(''')z ([fF])(")z ([fF])(')z(?i)(rb|br|r)(""")tdqsz(?i)(rb|br|r)(''')tsqsz(?i)(rb|br|r)(")dqsz(?i)(rb|br|r)(')sqsz ([uU]?)(""") stringescapez ([uU]?)(''')z ([uU]?)(")z ([uU]?)(')z ([bB])(""") bytesescapez ([bB])(''')z ([bB])(")z ([bB])(')[^\S\n]+numbersz!=|==|<<|>>|:=|[-~+/*%=<>&^|.] []{}:(),;[](in|is|and|or|not)\bz expr-keywordsbuiltins magicfuncs magicvarsnamer?z[{([]zexpr-inside-fstring-innerz(=\s*)?(\![sraf])?\}#popz(=\s*)?(\![sraf])?:\s+z[])}])z async forawaitelseforiflambdayield yield from\bsuffix)TrueFalseNone)assertasyncribreakcontinuedelelifrjexceptfinallyrkglobalrlrmpassraisenonlocalreturntrywhilernroaswithz6(^[ \t]*)(match|case)\b(?![ \t]*(?:[:,;=^&|@~)\]}]|(?:|c#HK|]}|djs|yw)rN)islower).0ks r; zPythonLexer.sCQAaDLLNqCs""z)\b))zsoft-keywords-innerz(\s+)([^\n_]*)(_\b))C __import__absaiterallanybinbool bytearray breakpointbytescallablechr classmethodcompilecomplexdelattrdictdirdivmod enumerateevalfilterfloatformat frozensetgetattrglobalshasattrhashhexidinputint isinstance issubclassiterlenlistlocalsmapmax memoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesorted staticmethodstrsumsupertupletypevarszip(?fed9d6d37ej@fgd ed:d34ejBjDfgd!ed;d34ejFjDfgd1de$jLfd?e$jNfd@e$jPfdAe$jRjTfdBe$jRfgd"dCe jVfgd0dDejXfdEefgded dEejBdFfe-dFgddEej\dFfgddGefdHej2fdIefdJej2fe-dFgddGefdKej2dFfdLej<j>dFfdMej2fe-dFgd,dNe j^fgdOe e j&dPe e j4d(dQe j4dFfdRe j^fedPgd*dSe j&dFfdTe j^fedOgdUe j4dFfedPd e j4fgdVe j&dFfedOd e j&fgdWZ0dXZ1yY)Zra For Python 2.x source code. .. versionchanged:: 2.5 This class has been renamed from ``PythonLexer``. ``PythonLexer`` now refers to the Python 3 variant. File name patterns like ``*.py`` have been moved to Python 3 as well. z Python 2.xr%python2py2ztext/x-python2zapplication/x-python2c:dtjfd|fd|fd|fgS)NG%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%] [^\\\'"%\n]+r6%r7r9s r;r<zPython2Lexer.innerstring_ruless6&'- 8e $   5M  r=rArBrCrDr_rErFrarGrHrbz!=|==|<<|>>|[-~+/*%=<>&^|.]rIrJrKrLrMrNrOrPrQrcrdrebacktickz!([rR]|[uUbB][rR]|[rR][uUbB])(""")rYz!([rR]|[uUbB][rR]|[rR][uUbB])(''')rZz([rR]|[uUbB][rR]|[rR][uUbB])(")r[z([rR]|[uUbB][rR]|[rR][uUbB])(')r\z([uUbB]?)(""")r]z([uUbB]?)(''')z ([uUbB]?)(")z ([uUbB]?)(')rfr`)rvrxryrzr{rjr|execr}rkr~rlrmrrrrrrrnrorrrprq)Nrrrrapply basestringrrbufferrrrrrcmpcoercerrrrrrrrexecfileexitfilerrrrrrrrrrrinternrrrrrrlongrrrrrrrrrrr raw_inputreducereloadrrrrrrrrrrrrrunichrunicoderxrangerrrz;(?r?r@rArBrC__iop__rDrErFrGrHrIrJrKrL__long__rNrOrQrRrSrTrUrV __nonzero____oct____op__rXrYrZr\r]__rcmp____rdiv__r^r_r`rarbrdre__rop__rfrhrirjrkrlrmrnrorp __setslice__rqrrrsrt __unicode__ru)rwrxryrzr{r|r}r~rr __metaclass__rrrrrrz'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?z\d+[eE][+-]?[0-9]+j?z 0[0-7]+j?z 0[bB][01]+0[xX][a-fA-F0-9]+\d+Lz\d+j?`.*?`z@[\w.]+ [a-zA-Z_]\w*rgz(?:[ \t]|\\\n)+as\b,[a-zA-Z_][\w.]*zimport\br[a-zA-Z_.][\w.]*Y\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})rrrrrrrr)rYrZct|dS)Nzpythonw?2(\.\d)?rrs r;rzPython2Lexer.analyse_text{st%899r=N)2rrrr}rfrrrrrr<rrrrrrrrrrrrrrrrr r rrrrrrrrrrrrrLongBacktickrrrrrrrr=r;rrs* D "C% GI!#:;IM  { J  6 j&,, ; = 6 j&,, ; = $  )) * gnn % [ ) dO DM $hmm 4 +X 6 J  #Xgz%BJ O %x'Dk R $hw/@/@*&M   &1B1BJ(O   J  L ! K J  0 fllFMM 2F < 0 fllFMM 2F < . fllFMM 2E ; . fllFMM 2E ; x fmmD nf - / x fmmD nf - / XfllFMMB ne , . XfllFMMB ne , . FO I U+ {Z  ,5: ;    [{j   >"% 1\\ \\(( * 5>HPUW^^ #! k{n  *$38%9&]] ' " o{Z  ,   ]]  " [{l  7 F $fll 3 6:: & FJJ ' !6:: . fnn)) * v~~ & m{~  foo & {D   ( d # E{L  L ! dmmV 4 FO M{V  djj& 1 W{\   & g'' ( 8   0 FO  ]{j   & '++V 4 ++V 4 $.. 1 FO  k{B <=C]] L C{J +FMM:K{L +FMM:M{N  6==& ) v}} - $ % O{X  6==& ) v}} - $ % Y{dV]]F + $ % FMM " V]]F + $ % FMM " m{Fz:r=rceZdZdZddgZdgZ deeje jdfdeeje fde jd fd e jd fd ejfgd eeje jfd eeje fedgdedfdeej"e fd e jfgdZy)_PythonConsoleLexerBasePython console sessionpyconpython-consoletext/x-python-doctestz (>>> )(.*\n) continuationsz (>>>)(\n)z,(\^C)?Traceback \(most recent call last\):\n tracebackz File "[^"]+", line \d+z.*\nz(\.\.\. )(.*\n)z (\.\.\.)(\n)rgz (?=>>>( |$))z(KeyboardInterrupt)(\n))rArrN)rrrrfrrrrPromptrCoder TracebackOutputrrrrrrr=r;rrs #D()G()Ihw~~uzzBO T8GNNJ? @ >> a = 'foo' >>> print(a) foo >>> 1 / 0 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: integer division or modulo by zero Additional options: `python3` Use Python 3 lexer for code. Default is ``True``. .. versionadded:: 1.0 .. versionchanged:: 2.5 Now defaults to ``True``. rrrrhttps://python.orgrc t|dd}|r tt}n tt}Gfddt }t |||tjfi|y)Nr)Tc"eZdZfdZxZS)6PythonConsoleLexer.__init__.._ReplaceInnerCodecNt|ttjfi|yN)rr@rrr)selfoptionsrxpylexers r;r@z?PythonConsoleLexer.__init__.._ReplaceInnerCode.__init__s *A5::YQXYr=)rrrr@ __classcell__)rxrs@r;_ReplaceInnerCoder s Z Zr=r) r rrrrrrr@rr)rrr)tblexerrrrxs @r;r@zPythonConsoleLexer.__init__sSw 48 !G*G"G+G  Z Z "3U__PPr=) rrrr}rfrrrrr@r)rxs@r;rrs8. $D()G()I CMQQr=rc eZdZdZdZddgZddgZddgZd Zd Z d e fd e jd fde jfde jfde jd fde fgdeeej"eeeee fdeeej"eee fdee eee dfdee ee fdee j,eee dfdee j,e dfedgdee ej2e dfedgdZy)rz For Python 3.x tracebacks, with support for chained exceptions. .. versionchanged:: 2.5 This is now the default ``PythonTracebackLexer``. It is still available as the alias ``Python3TracebackLexer``. zPython Tracebackpytbpy3tbz*.pytbz*.py3tbztext/x-python-tracebackztext/x-python3-tracebackrz1.0rBz-^(\^C)?Traceback \(most recent call last\):\nintbzH^During handling of the above exception, another exception occurred:\n\nzI^The above exception was the direct cause of the following exception:\n\n^(?= File "[^"]+", line \d+)^.*\n0^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)%^( File )("[^"]+")(, line )(\d+)(\n)^( )(.+)(\n)markers^([ \t]*)(\.\.\.)(\n)^([^:]+)(: )(.+)(\n)rgz^([a-zA-Z_][\w.]*)(:?\n)z^( {4,})([~^]+)(\n))rArrN)rrrr}rfrrrrrrrrrrrrrrrrrrrrMarkerrrr=r;rrs{ DwG9%I*,FGI CMJ  =w?P?PRX Y()0):): <)*1*;*; = -w/@/@& I u   A dDLL$dJ O Q 5 dDLL$ C E  j% "4j A9 N % j': 6 8 $ gmmT4 ,>? H FO 1Fr=rc eZdZdZdZdZgdZgdZddgZdZ id gd e fd e e e jfd e e e jfd efdefdefde fdefdej$fde eej(efdefde eej,ee eeefedde ee dfde ee dfde eefde ee dfde ee dfd e ee d!fed"ed#d$e d%fd&e d'fd(e d)fd*e d+fd,e ed-d%fd.e ed-d'fd/e ed-d)fd0e ed-d+fed1ed2ded3d45efd6ej6fgd"ed7d8d49ej8fd:ej8j:fed;d8d49ej<fgd2dfd=ej@fd>ejBfd?ej,jDfd@ej,fgd#dAe jFfgd1dBejHfdCefgddCejJdDfgddEejLfdFefdGe ejJe dDfdHe ejJe efdIedDfdJefdKedDfdLedDfdCej(fdMefg ddCejNdDfgd!dNe e ee fdOejPfdPe e ee fe)dDgddQe e edDfdRejPfe)dDgd-dSe jTfgdTdUe jVfdVe fdWe fdXe fgdYd e fgd)dZe dDfd[e jTfedTgd+d\e dDfd]e jTfedTgd%d^e dDfedTedYgd'd_e dDfedTedYgiZ,y`)ar z+ For Pyrex and Cython source code. Cythonzhttps://cython.org)cythonpyxpyrex)z*.pyxz*.pxdz*.pxiz text/x-cythonzapplication/x-cythonz1.1rArBz^(\s*)("""(?:.|\n)*?""")z^(\s*)('''(?:.|\n)*?''')r_rFrarGrHrbz(<)([a-zA-Z0-9.?]+)(>)z!=|==|<<|>>|[-~+/*%=<>&^|.?]z(from)(\d+)(<=)(\s+)(<)(\d+)(:)rIz(def|property)(\s+)rKz (cp?def)(\s+)cdefz (cdef)(:)z(class|struct)(\s+)rMz (from)(\s+)rOz(c?import)(\s+)rQrcrz(?:[rR]|[uU][rR]|[rR][uU])"""rYz(?:[rR]|[uU][rR]|[rR][uU])'''rZz(?:[rR]|[uU][rR]|[rR][uU])"r[z(?:[rR]|[uU][rR]|[rR][uU])'r\z[uU]?"""r]z[uU]?'''z[uU]?"z[uU]?'rfr`)rvrwrirxbyryctypedefrzr{rjr|zexcept?rr}rkfusedgilr~rlrrmnogilrrrrrrrnrrrprqz(DEF|IF|ELIF|ELSE)\b)Qrrrrrrrbintrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr Py_ssize_trrrrrrrrrrrrrrrrrrrunsignedrrrrrz<(?s} D C(G+I "89IMd$ J $ ((:vzz*J K$ )(:vzz*J K$ $  $ g  $ [ ) $ j !$ DM$ %hmm 4$ ' k7<< = ?$ -h 7$ 0 gv~~xXK) *$ J !$ "$Xgz%BJ O#$ $x I/$ 0 J 1$ 2 J 3$ 4-ff =5$ 6-ff =7$ 8+FE :9$ :+FE :;$ <.&!A B=$ >.&!A B?$ @vx> ?A$ Bvx> ?C$ D FOE$ F I G$ dL  JSX Y    %goo 6 Md^   )2(?> 2 &(>68*T U &(>68*T U (Q R (Q R  " ((-- 8 (( 3 5 %] < \\  M%] <\\ O \\  "D ^^ %&*nn 645<5E5E G#D ) #W\\ 2 t  k " 5Mm7 r<=C]] L &'- 8 f %  6N FO  66 " 66 " VV $ VV $ aSFr=r!c>eZdZdZdZdZdgZdZgZgZ hdZ dZ dZ y ) r"z? A Python lexer recognizing Numerical Python builtins. NumPyzhttps://numpy.org/numpyr3>c_i0r_s_raddrrcoscovdotexpeyefftfixinfinvix_logmatrrmodnanptpputsinstdrsvdtantrivarwhoalenamaxaminbetabmatceilclipconjcopycoshdiagdiffdispdumpfabsfillflatfmodifftimaginfoitemkronlessloadlog2meanmodfndimonespinvpolyprodranfrankrealrintrollseedsignsincsinhsizesortsqrtrItanhtesttiletriltriuvdotviewanglearrayrcrossdtypedumpsemptyequalexpm1finfofloorfrexphypotinnerisinfisnanldexploadslog10log1plstsqmgridmsortogridouterplacepowerravelrootsrot90rshapersolvesplittracetrapzwherezerosappendarangearccosarcsinarctanargmaxargminaroundastypechoosecumsumdeletedividedsplitdstackfliplrflipudgeterrgumbelhsplithstackinsertinterpinvertisrealkaisermatrixmediannanmaxnanminnansumpoly1drrepeatresizeround_sampleselectseterrsourcesquaretofiletolistuniqueunwrapvandervsplitvstackalltruearccosharcsinharctan2arctanhargsortasarrayaveragecumprodediff1dextractfftfreqflattengenericgreaterhamminghanningindicesitemsetlexsortloadtxtmaximumminimumndindexnewaxisnonzeropkgloadpoissonpolyaddpolyderpolydivpolyfitpolyintpolymulpolysubpolyvalproductputmaskrandintrequirereshapesavetxtshufflesignbitsqueezeuniformunion1dweibullabsoluteallclosealterdotargwhereasfarrayasmatrixasscalarbartlettbincountbinomialblackmanbyteswapcan_castcompressconvolvecorrcoefdiagflatdiagonaldigitizefftshiftfromfilefromitergetfieldgradientidentityisfiniteisneginfisposinfisscalarissctypeiterablelinspacelogspacemeshgridmultiplynegativerecarrayrollaxissetfieldsetflagssetxor1dsometruesubtractswapaxestostringtypeDicttypenameunique1dvonmises array_str base_repr broadcast conjugate correlate deprecate getbuffer geterrobj histogram index_exp iscomplex isfortran isrealobj nanargmax nanargmin newbuffer not_equal ones_like piecewise remainder row_stack setdiff1d seterrobj tensordot transpose vectorize accumulate array_repr arrayrange asanyarray atleast_1d atleast_2d atleast_3d bitwise_or cumproduct empty_like fromarrays frombuffer frompyfunc fromstring getbufsize geterrcall issubdtype left_shift less_equal logical_or nan_to_num obj2sctype reciprocal restoredot setbufsize seterrcall trim_zeros zeros_like array_equal array_equiv array_split binary_repr bitwise_and bitwise_not bitwise_xor byte_bounds common_type concatenate expand_dims flatnonzero get_include histogram2d histogramdd intersect1d issubclass_ issubsctype logical_and logical_not logical_xor mintypecode ndenumerate permutation right_shift sctype2char setmember1d show_config true_divide array2string column_stack floor_divide fromfunction int_asbuffer iscomplexobj newbyteorder searchsorted sort_complex greater_equal random_sample real_if_close unravel_indexasfortranarrayget_array_wrapintersect1d_numaximum_sctypeapply_over_axesrandom_integersset_numeric_opsstandard_normalapply_along_axisget_printoptionsmay_share_memoryset_printoptionsasarray_chkfiniteascontiguousarrayget_numpy_includecompare_chararraysset_string_functionfastCopyAndTransposeget_numarray_includec#Ktj||D]9\}}}|tur$||jvr|tj |f3|||f;ywr )rget_tokens_unprocessedrEXTRA_KEYWORDSrr)rrindextokenvalues r;rz!NumPyLexer.get_tokens_unprocesseds[224> * E5%}$*=*=!=W^^U22UE))  *sAAcH|dd}t|dxsd|vxr d|vxsd|vS)Nrrrz import numpyzfrom numpy importr)rltexts r;rzNumPyLexer.analyse_textsDUd &<=#U"J5(H,?5,H Jr=N) rrrr}rfrrrrrrrrrr=r;r"r"Ts? D CiGMIIANF*Jr=r")+r}rpygments.lexerrrrrrrr r r pygments.utilr r pygments.tokenrrrrrrrrrrrrpygmentsrr__all__r Python3LexerrrrrPython3TracebackLexerrr r!r"rr=r;rs4447;;;;% 3 A%*A%H  \::\:~"j"J.Q.Qb3:3l--J-`p*pf`j`F]J]Jr=