B
    G
\1                 @   s*  d Z ddlZddlmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddd	d
ddddgZedZ G dd deZ!G dd
 d
eZ"G dd deZ#G dd	 d	eZ$G dd deZ%G dd deZ&G dd deZ'G dd de!Z(dS )z
    pygments.lexers.python
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Python and related languages.

    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)	Lexer
RegexLexerincludebygroupsusingdefaultwordscombineddo_insertions)get_bool_optshebang_matches)TextCommentOperatorKeywordNameStringNumberPunctuationGenericOtherError)	unistringPythonLexerPythonConsoleLexerPythonTracebackLexerPython3LexerPython3TracebackLexerCythonLexerDgLexer
NumPyLexerz.*?
c                @   sr  e Zd ZdZdZdddgZdddd	d
ddgZddgZdd Zde	fde
e	ejejfde
e	ejejfde	fdejfdejfdefde	fde	fdejfdefedde
ee	dfde
ee	d fd!e
eje	d"fd#e
eje	d$fed%ed&ed'ed(d)e
ejejd*fd+e
ejejd,fd-e
ejejd.fd/e
ejejd0fd1e
ejejed2d*fd3e
ejejed2d,fd4e
ejejed2d.fd5e
ejejed2d0fed6ed7ged8d9d:efged;d<d9d=ejfd>ejjfed?d<d9d=ejfged@d9d:ejjfgedAd9d:ej jfgdBe!j"fdCe!j"fdDe!j#fdEe!j$fdFe!j%fdGe!j&j'fdHe!j&fgdIej(fgdJej)fdKefged&dKejdLfe*dLgdKej+dLfgdMe	fdNejfdOefdPejfe*dLgdMe	fdQejdLfdRejjdLfdSejfe*dLgdTej,fgeejeejdUejdLfdVej,fedWgdXejdLfdYej,fedZgd[ejdLfedWdejfgd\ejdLfedZdejfgd]Z-d^d_ Z.d`S )ar   z<
    For `Python <http://www.python.org>`_ source code.
    PythonZpythonpyZsagez*.pyz*.pywz*.scZ
SConstructZ
SConscriptz*.tacz*.sageztext/x-pythonzapplication/x-pythonc             C   s   dt jfd| fd| fd| fgS )NzG%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]z[^\\\'"%\n]+z[\'"\\]%)r   Interpol)ttype r&   5lib/python3.7/site-packages/pygments/lexers/python.pyinnerstring_rules&   s
    zPythonLexer.innerstring_rulesz\nz&^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")z&^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')z[^\S\n]+z\A#!.+$z#.*$z[]{}:(),;[]z\\\nz\\z(in|is|and|or|not)\bz!=|==|<<|>>|[-~+/*%=<>&^|.]keywordsz(def)((?:\s|\\\s)+)funcnamez(class)((?:\s|\\\s)+)	classnamez(from)((?:\s|\\\s)+)
fromimportz(import)((?:\s|\\\s)+)importbuiltins
magicfuncs	magicvarsbacktickz!([rR]|[uUbB][rR]|[rR][uUbB])(""")tdqsz!([rR]|[uUbB][rR]|[rR][uUbB])(''')tsqsz([rR]|[uUbB][rR]|[rR][uUbB])(")dqsz([rR]|[uUbB][rR]|[rR][uUbB])(')sqsz([uUbB]?)(""")stringescapez([uUbB]?)(''')z([uUbB]?)(")z([uUbB]?)(')namenumbers)assertbreakcontinuedelelifelseexceptexecfinallyforglobaliflambdapassprintraisereturntrywhileyieldz
yield fromaswithz\b)suffix)N
__import__absallanyapply
basestringbinboolbuffer	bytearraybytescallablechrclassmethodcmpcoercecompilecomplexdelattrdictdirdivmod	enumerateevalexecfileexitfilefilterfloat	frozensetgetattrglobalshasattrhashhexidinputintintern
isinstance
issubclassiterlenlistlocalslongmapmaxminnextobjectoctopenordpowpropertyrange	raw_inputreducereloadreprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypeunichrunicodevarsxrangezipz(?<!\.))prefixrO   z;(?<!\.)(self|None|Ellipsis|NotImplemented|False|True|cls)\b)5ArithmeticErrorAssertionErrorAttributeErrorBaseExceptionDeprecationWarningEOFErrorEnvironmentError	ExceptionFloatingPointErrorFutureWarningGeneratorExitIOErrorImportErrorImportWarningIndentationError
IndexErrorKeyErrorKeyboardInterruptLookupErrorMemoryErrorModuleNotFoundError	NameErrorNotImplementedNotImplementedErrorOSErrorOverflowErrorOverflowWarningPendingDeprecationWarningRecursionErrorReferenceErrorRuntimeErrorRuntimeWarningStandardErrorStopIterationStopAsyncIterationSyntaxErrorSyntaxWarningSystemError
SystemExitTabError	TypeErrorUnboundLocalErrorUnicodeDecodeErrorUnicodeEncodeErrorUnicodeErrorUnicodeTranslateErrorUnicodeWarningUserWarning
ValueErrorVMSErrorWarningWindowsErrorZeroDivisionError)___abs____add____and____call__Z__cmp__Z
__coerce____complex____contains____del____delattr__
__delete____delitem__Z__delslice__Z__div__
__divmod__	__enter____eq____exit__	__float____floordiv____ge____get____getattr____getattribute____getitem__Z__getslice____gt____hash__Z__hex____iadd____iand__Z__idiv____ifloordiv____ilshift____imod____imul__	__index____init____instancecheck____int__
__invert__Z__iop____ior____ipow____irshift____isub____iter____itruediv____ixor____le____len__Z__long__
__lshift____lt____missing____mod____mul____ne____neg____new__Z__nonzero__Z__oct__Z__op____or____pos____pow____radd____rand__Z__rcmp__Z__rdiv____rdivmod____repr____reversed____rfloordiv____rlshift____rmod____rmul__Z__rop____ror____rpow____rrshift__
__rshift____rsub____rtruediv____rxor____set____setattr____setitem__Z__setslice____str____sub____subclasscheck____truediv__Z__unicode____xor__)	__bases__	__class____closure____code____defaults____dict____doc____file____func____globals__Z__metaclass__
__module____mro____name____self__	__slots____weakref__z'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?z\d+[eE][+-]?[0-9]+j?z	0[0-7]+j?z
0[bB][01]+z0[xX][a-fA-F0-9]+z\d+Lz\d+j?z`.*?`z@[\w.]+z[a-zA-Z_]\w*z#popz(?:[ \t]|\\\n)+zas\b,z[a-zA-Z_][\w.]*zimport\bzNone\bz[a-zA-Z_.][\w.]*zY\\([\\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})"z\\\\|\\"|\\\nzstrings-double'z\\\\|\\'|\\\nzstrings-singlez"""z''')rootr)   r.   r/   r0   r8   r1   r7   r*   r+   r-   r,   r6   zstrings-singlezstrings-doubler4   r5   r2   r3   c             C   s   t | dpd| d d kS )Nzpythonw?(2(\.\d)?)?zimport i  )r   )textr&   r&   r'   analyse_text   s    
zPythonLexer.analyse_textN)/r.  r,  __qualname__r(  r7   aliases	filenames	mimetypesr(   r   r   r   ZAffixDocr   ZHashbangSingler   r   Wordr   r   	NamespaceDoubler	   r   r   BuiltinPseudor   FunctionMagicVariabler   FloatOctBinHexIntegerLongBacktick	Decoratorr   ClassEscapetokensr7  r&   r&   r&   r'   r      s   
















c               @   s  e Zd ZdZdZddgZg ZddgZej	ej
B Zdejejf Zdd	 Zej Zed
ddefedddejfged< eddddejfdejjfeddddejfged< edddejjfged< edddejjfged< dejfdejfdej fdej!fdej"fdej#fged< g ed < d!ej$fd"e%feefged#< eejd$fged%< eej&d$fged&< d'e'e(ee(fd(ej)feej)fd)e'e(e%e(fe*d$ged*< d+e'e(ed$fd(ej)feej)fe*d$ged,< ee+j,ed-< ee+j-ed.< d/d0 Z.d1S )2r   zf
    For `Python <http://www.python.org>`_ source code (version 3.0).

    .. versionadded:: 0.10
    zPython 3python3Zpy3ztext/x-python3zapplication/x-python3z	[%s][%s]*c             C   s&   dt jfdt jfd| fd| fd| fgS )NzH%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsaux%]zg\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\![sra])?(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}z[^\\\'"%{\n]+z[\'"\\]z%|(\{{1,2}))r   r$   )r%   r&   r&   r'   r(     s    zPython3Lexer.innerstring_rules)r9   asyncawaitr:   r;   r<   r=   r>   r?   rA   rB   rC   rD   rE   rF   rH   nonlocalrI   rJ   rK   rL   z
yield fromrM   rN   z\b)rO   )TrueFalseNoner)   )ArP   rQ   rR   rS   rV   rW   rY   rZ   r\   r]   r^   r`   ra   rb   rc   rd   re   rf   rg   rk   rl   formatrm   rn   ro   rp   rq   rr   rs   rt   ru   rw   rx   ry   rz   r{   r|   r~   r   
memoryviewr   r   r   r   r   r   r   rG   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   z(?<!\.))r   rO   z+(?<!\.)(self|Ellipsis|NotImplemented|cls)\b)Ar   r   r   r   BufferErrorBytesWarningr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ResourceWarningr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   BlockingIOErrorChildProcessErrorConnectionErrorBrokenPipeErrorConnectionAbortedErrorConnectionRefusedErrorConnectionResetErrorFileExistsErrorFileNotFoundErrorInterruptedErrorIsADirectoryErrorNotADirectoryErrorPermissionErrorProcessLookupErrorTimeoutErrorr.   )_r   r   
__aenter__	__aexit__	__aiter__r   	__anext__	__await____bool__	__bytes__r   r   r   r   r   r   r   __dir__r   r   r   r   r   r   
__format__r   r   r   r   r   r   r   r   r   r   r   __imatmul__r   rP   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __length_hint__r   r   
__matmul__r  r  r  r  r  r  __next__r  r  r	  __prepare__r
  r  r  r  r  r  r  __rmatmul__r  r  r  	__round__r  r  r  r  r  r  r  r  r  r  r  r  r   r!  r/   )__annotations__r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  __kwdefaults__r,  r-  r.  __objclass__r8  r/  r0  r1  r0   zT(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)([eE][+-]?\d(?:_?\d)*)?z!\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?z0[oO](?:_?[0-7])+z0[bB](?:_?[01])+z0[xX](?:_?[a-fA-F0-9])+z\d(?:_?\d)*r8   r1   z@\w+@r7   z#popr*   r+   z(\s+)(as)(\s+)z\.z(\s*)(,)(\s*)r-   z(\s+)(import)\br,   zstrings-singlezstrings-doublec             C   s
   t | dS )Nzpythonw?3(\.\d)?)r   )r6  r&   r&   r'   r7    s    zPython3Lexer.analyse_textN)/r.  r,  r8  r(  r7   r9  r:  r;  re	MULTILINEUNICODEflagsuniZ	xid_startZxid_continueZuni_namer(   r   rP  copyr   r   ZConstantr   rA  rB  r   rC  rD  rE  r   rF  rG  rH  rI  rJ  rM  r   rN  r   r   r?  r   r   r=  r@  r7  r&   r&   r&   r'   r      st   

c               @   s0   e Zd ZdZdZdgZdgZdd Zdd Zd	S )
r   a  
    For Python console output or doctests, such as:

    .. sourcecode:: pycon

        >>> a = 'foo'
        >>> print a
        foo
        >>> 1 / 0
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        ZeroDivisionError: integer division or modulo by zero

    Additional options:

    `python3`
        Use Python 3 lexer for code.  Default is ``False``.

        .. versionadded:: 1.0
    zPython console sessionZpyconztext/x-python-doctestc             K   s    t |dd| _tj| f| d S )NrQ  F)r   rQ  r   r   )selfoptionsr&   r&   r'   r     s    zPythonConsoleLexer.__init__c          	   c   s@  | j r tf | j}tf | j}ntf | j}tf | j}d}g }d}d}d}xt|D ]}	|	 }
|
	ds||
	drd}|
t|dtj|
d d fgf ||
dd  7 }qZ|
 dkr|s|
t|dtjdfgf ||
dd  7 }qZ|r$x t|||D ]}|V  qW d}g }|
	ds>td	|
rPd
}|
}|	 }qZ|
dkrn|	 tj|
fV  qZ|r||
7 }|
	ds|
 dksd}x*||D ]\}}}|| ||fV  qW d}qZ|	 tj|
fV  qZW |r
x t|||D ]}|V  qW |r<x*||D ]\}}}|| ||fV  qW d S )N r   z>>> z...    z...   z"Traceback (most recent call last):z  File "[^"]+", line \d+\n$   zKeyboardInterrupt
 )rQ  r   r  r   r   r   line_refinditergroup
startswithappendrz   r   ZPromptrstripr
   get_tokens_unprocessedr  matchstartr   rN  stripZOutput)r  r6  ZpylexerZtblexerZcurcodeZ
insertionsZcurtbZtbindextbr  lineitemitvr&   r&   r'   r    sb    



z)PythonConsoleLexer.get_tokens_unprocessedN)	r.  r,  r8  r(  r7   r9  r;  r   r  r&   r&   r&   r'   r     s   c               @   s   e Zd ZdZdZdgZdgZdgZdee	e
jdfde
jdfd	efgd
ee	eje	ee	ee	fdee	eje	ee	fdee	eee	fdee	ee	fdee
je	ee	dfdee
je	dfgdZdS )r   z;
    For Python tracebacks.

    .. versionadded:: 0.7
    zPython TracebackZpytbz*.pytbztext/x-python-tracebackz^(\^C)?(Traceback.*\n)intbz^(?=  File "[^"]+", line \d+)z^.*\nz0^(  File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)z%^(  File )("[^"]+")(, line )(\d+)(\n)z^(    )(.+)(\n)z^([ \t]*)(\.\.\.)(\n)z^([^:]+)(: )(.+)(\n)z#popz^([a-zA-Z_]\w*)(:?\n))r5  r  N)r.  r,  r8  r(  r7   r9  r:  r;  r   r   r   	Tracebackr   r   rA  r   r   r   r   r   rP  r&   r&   r&   r'   r     s*   
c               @   s   e Zd ZdZdZdgZdgZdgZdefde	j
dfd	e	j
fd
e	j
fde	j
dfgdeeejeeeeefdeeejeeefdeeeeefdeeeefdee	jeeedfdee	jedfgdZdS )r   zd
    For Python 3.0 tracebacks, with support for chained exceptions.

    .. versionadded:: 1.0
    zPython 3.0 TracebackZpy3tbz*.py3tbztext/x-python3-tracebackz\nz'^Traceback \(most recent call last\):\nr  zH^During handling of the above exception, another exception occurred:\n\nzI^The above exception was the direct cause of the following exception:\n\nz^(?=  File "[^"]+", line \d+)z0^(  File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)z%^(  File )("[^"]+")(, line )(\d+)(\n)z^(    )(.+)(\n)z^([ \t]*)(\.\.\.)(\n)z^([^:]+)(: )(.+)(\n)z#popz^([a-zA-Z_]\w*)(:?\n))r5  r  N)r.  r,  r8  r(  r7   r9  r:  r;  r   r   r  r   r   rA  r   r   r   r   r   rP  r&   r&   r&   r'   r     s0   
c            !   @   sL  e Zd ZdZdZdddgZdddgZd	d
gZdefde	ee
jfde	ee
jfdefdefdefdefdefdejfde	eejefdefde	eejeeeeefedde	eedfde	eedfde	eefde	eedfde	eed fd!e	eed"fed#ed$d%e
d&fd'e
d(fd)e
d*fd+e
d,fd-e
ed.d&fd/e
ed.d(fd0e
ed.d*fd1e
ed.d,fed2ed3ged4d5d6efd7ejfged8d9d5d:ejfd;ejjfed<d9d5d:ejfgd=ejfd>ejfd?ejfd@ejjfdAejfgdBe
j fgdCej!fdDefgdDej"dEfgdFej#fdGefdHe	ej"edEfdIe	ej"eefdJedEfdKefdLedEfdMedEfdDejfdNefg
dDej$dEfgdOe	eeefdPej%fdQe	eeefe&dEgdRe	eedEfdSej%fe&dEgdTe
j'fgdUe
j(fdVe
fdWe
fdXe
fgde
fgdYe
dEfdZe
j'fed[gd\e
dEfd]e
j'fed[gd^e
dEfed[ed_gd`e
dEfed[ed_gdaZ)dbS )cr   z]
    For Pyrex and `Cython <http://cython.org>`_ source code.

    .. versionadded:: 1.1
    ZCythonZcythonZpyxZpyrexz*.pyxz*.pxdz*.pxiztext/x-cythonzapplication/x-cythonz\nz^(\s*)("""(?:.|\n)*?""")z^(\s*)('''(?:.|\n)*?''')z[^\S\n]+z#.*$z[]{}:(),;[]z\\\nz\\z(in|is|and|or|not)\bz(<)([a-zA-Z0-9.?]+)(>)z!=|==|<<|>>|[-~+/*%=<>&^|.?]z(from)(\d+)(<=)(\s+)(<)(\d+)(:)r)   z(def|property)(\s+)r*   z(cp?def)(\s+)cdefz	(cdef)(:)z(class|struct)(\s+)r+   z(from)(\s+)r,   z(c?import)(\s+)r-   r.   r1   z(?:[rR]|[uU][rR]|[rR][uU])"""r2   z(?:[rR]|[uU][rR]|[rR][uU])'''r3   z(?:[rR]|[uU][rR]|[rR][uU])"r4   z(?:[rR]|[uU][rR]|[rR][uU])'r5   z[uU]?"""r6   z[uU]?'''z[uU]?"z[uU]?'r7   r8   )r9   r:   Zbyr;   Zctypedefr<   r=   r>   r?   zexcept?r@   rA   rB   ZfusedZgilrC   rD   r   rE   ZnogilrF   rG   rH   rI   rJ   rK   rL   rM   rN   z\b)rO   z(DEF|IF|ELIF|ELSE)\b)OrP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zunsignedr   r   r   z(?<!\.))r   rO   z<(?<!\.)(self|None|Ellipsis|NotImplemented|False|True|NULL)\b)0r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   z&(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?z0\d+z0[xX][a-fA-F0-9]+z\d+Lz\d+z`.*?`z@\w+z[a-zA-Z_]\w*z#popz%(public|readonly|extern|api|inline)\bz(struct|enum|union|class)\bz([a-zA-Z_]\w*)(\s*)(?=[(:#=]|$)z([a-zA-Z_]\w*)(\s*)(,)zfrom\bzas\b:z	(?=["\']).z(\s+)(as)(\s+)z[a-zA-Z_][\w.]*z(\s*)(,)(\s*)z(\s+)(c?import)\bz[a-zA-Z_.][\w.]*zY\\([\\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})zP%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]z[^\\\'"%\n]+z[\'"\\]r#   r3  z\\\\|\\"|\\\nstringsr4  z\\\\|\\'|\\\nz"""nlz''')r5  r)   r.   r8   r1   r7   r*   r  r+   r-   r,   r6   r  r  r4   r5   r2   r3   N)*r.  r,  r8  r(  r7   r9  r:  r;  r   r   r   r<  r   r   r   r>  r   Typer   rJ  r   r   r	   r   ZPreprocrA  rB  r   rF  rG  rI  rK  rL  rM  rC  ReservedrN  r?  r   rO  r$   rP  r&   r&   r&   r'   r   :  s   





c               @   sz  e Zd ZdZdZdgZdgZdgZdefde	j
fdejfdejfd	ejfd
ejfdejfdejfdeedddfdeedddfdeedddfdeedddfdefdejfdefeddddejfeddddejfdejjfd ejfd!ejfd"ejfd#efd$ejfd%efd&efd'efgd(ejfgd)ej fd*efd+efd,efd-efgd.ed/fgd0ed/fgd1ed/fgd2ed/fgd3Z!d4S )5r   z
    Lexer for `dg <http://pyos.github.com/dg>`_,
    a functional and object-oriented programming language
    running on the CPython 3 VM.

    .. versionadded:: 1.6
    Zdgz*.dgz	text/x-dgz\s+z#.*?$z(?i)0b[01]+z(?i)0o[0-7]+z(?i)0x[0-9a-f]+z((?i)[+-]?[0-9]+\.[0-9]+(e[+-]?[0-9]+)?j?z(?i)[+-]?[0-9]+e[+-]?\d+j?z(?i)[+-]?[0-9]+j?z(?i)(br|r?b?)'''r6   r3   stringz(?i)(br|r?b?)"""r2   z(?i)(br|r?b?)'r5   z(?i)(br|r?b?)"r4   z`\w+'*`z\b(and|in|is|or|where)\bz[!$%&*+\-./:<-@\\^|~;,]+)rW   rY   rZ   r]   ra   rc   zdict'rl   rm   ru   r{   zlist'rY  r   r   r   r   zset'r   r   r   r   r   ztuple'r   z(?<!\.)z
(?![\'\w]))r   rO   )=rP   rQ   rR   rS   rV   Zbindr\   r^   r`   ra   rb   rd   re   Zdrop	dropwhilerf   rg   Zexhaustrk   Zflipzfoldl1?rX  Zfstrn   ro   rp   rq   headrr   rs   Zinitrt   rw   rx   ry   ZiterateZlastrz   r|   r~   r   r   r   r   r   r   r   rG   r   r   r   r   zscanl1?Zsndr   r   tailtake	takewhiler   r   z>(?<!\.)(self|Ellipsis|NotImplemented|None|True|False)(?!['\w])z3(?<!\.)[A-Z]\w*(Error|Exception|Warning)'*(?!['\w])zT(?<!\.)(Exception|GeneratorExit|KeyboardInterrupt|StopIteration|SystemExit)(?!['\w])z_(?<![\w.])(except|finally|for|if|import|not|otherwise|raise|subclass|while|with|yield)(?!['\w])z[A-Z_]+'*(?!['\w])z[A-Z]\w+'*(?!['\w])z\w+'*z[()]r  zY\\([\\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})zG%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]z[^\\\'"%\n]+z[\'"\\]r#   z\nr3  z#popr4  z"""z''')r5  r6   r  r4   r5   r2   r3   N)"r.  r,  r8  r(  r7   r9  r:  r;  r   r   r=  r   rH  rG  rI  rF  rJ  r   r	   r   r>  r   r   rA  rB  r   r   r  r  r   r   rO  r$   rP  r&   r&   r&   r'   r     sj   


c               @   s:   e Zd ZdZdZdgZg Zg ZedZ	dd Z
dd Zd	S )
r    z[
    A Python lexer recognizing Numerical Python builtins.

    .. versionadded:: 0.10
    ZNumPyZnumpy(  rQ   Zabsolute
accumulateaddZalenrR   ZallcloseZalltrueZalterdotZamaxZaminZanglerS   r  Zapply_along_axisZapply_over_axesZarangeZarccosZarccoshZarcsinZarcsinhZarctanZarctan2ZarctanhZargmaxZargminZargsortZargwhereZaroundZarrayZarray2stringZarray_equalZarray_equivZ
array_reprZarray_splitZ	array_strZ
arrayrangeZ
asanyarrayZasarrayZasarray_chkfiniteZascontiguousarrayZasfarrayZasfortranarrayZasmatrixZasscalarZastypeZ
atleast_1dZ
atleast_2dZ
atleast_3dZaverageZbartlettZ	base_reprZbetaZbinary_reprZbincountZbinomialZbitwise_andZbitwise_notZ
bitwise_orZbitwise_xorZblackmanZbmatZ	broadcastZbyte_boundsrZ   ZbyteswapZc_Zcan_castZceilZchooseZclipZcolumn_stackZcommon_typeZcompare_chararrayscompressZconcatenateZconj	conjugateZconvolver  ZcorrcoefZ	correlateZcosZcoshZcovZcrossZcumprodZ
cumproductZcumsumdeleteZ	deprecateZdiagZdiagflatZdiagonalZdiffZdigitizeZdispZdividedotZdsplitZdstackZdtypedumpdumpsZediff1demptyZ
empty_likeZequalZexpZexpand_dimsZexpm1extractZeyeZfabsZfastCopyAndTransposeZfftZfftfreqZfftshiftZfillZfinfoZfixZflatZflatnonzeroZflattenZfliplrZflipudZfloorZfloor_divideZfmodZfrexpZ
fromarraysZ
frombufferZfromfileZfromfunctionZfromiterZ
frompyfuncZ
fromstringZgenericZget_array_wrapZget_includeZget_numarray_includeZget_numpy_includeZget_printoptions	getbufferZ
getbufsizeZgeterrZ
geterrcallZ	geterrobjZgetfieldZgradientZgreaterZgreater_equalZgumbelZhammingZhanningZ	histogramZhistogram2dZhistogramddZhsplitZhstackZhypotZi0ZidentityZifftimagZ	index_expindicesinfinfoinnerinsertZint_asbufferZinterpZintersect1dZintersect1d_nuinvinvertZ	iscomplexZiscomplexobjZisfiniteZ	isfortranZisinfZisnanZisneginfZisposinfZisrealZ	isrealobjZisscalarZissctypeZissubclass_Z
issubdtypeZissubsctyper  ZitemsetiterableZix_ZkaiserZkronZldexpZ
left_shiftZlessZ
less_equalZlexsortZlinspaceloadloadsZloadtxtlogZlog10Zlog1pZlog2Zlogical_andZlogical_notZ
logical_orZlogical_xorZlogspaceZlstsqZmatZmatrixr   ZmaximumZmaximum_sctypeZmay_share_memoryZmeanZmedianZmeshgridZmgridr   ZminimumZmintypecodemodZmodfZmsortZmultiplynanZ
nan_to_numZ	nanargmaxZ	nanargminZnanmaxZnanminZnansumZndenumeratendimZndindexnegativeZnewaxisZ	newbufferZnewbyteorderZnonzeroZ	not_equalZ
obj2sctypeZogridZonesZ	ones_likeZouterZpermutationZ	piecewiseZpinvZpkgloadZplaceZpoissonZpolyZpoly1dZpolyaddZpolyderZpolydivZpolyfitZpolyintZpolymulZpolysubZpolyvalZpowerZprodproductZptpZputZputmaskZr_ZrandintZrandom_integersZrandom_sampleZranfZrankZravelrealZreal_if_closeZrecarrayZ
reciprocalr   Z	remainderrepeatZrequireZreshapeZresizeZ
restoredotZright_shiftZrintZrollZrollaxisrootsZrot90r   Zround_Z	row_stackZs_ZsampleZsavetxtZsctype2charZsearchsortedZseedZselectZset_numeric_opsZset_printoptionsZset_string_functionZ
setbufsizeZ	setdiff1dZseterrZ
seterrcallZ	seterrobjZsetfieldZsetflagsZsetmember1dZsetxor1dshapeZshow_configZshuffleZsignZsignbitZsinZsincZsinhsizer   ZsolveZsometruesortZsort_complexsourcesplitZsqrtZsquareZsqueezeZstandard_normalZstdsubtractr   ZsvdZswapaxesr  ZtanZtanhZ	tensordotZtestZtileZtofiletolistZtostringZtraceZ	transposeZtrapzZtriZtrilZ
trim_zerosZtriuZtrue_divideZtypeDicttypenameZuniformZunion1duniqueZunique1dZunravel_indexZunwrapZvandervarZvdotZ	vectorizeZviewZvonmisesZvsplitZvstackZweibullwhereZwhoZzerosZ
zeros_likec             c   sN   xHt | |D ]8\}}}|tkr:|| jkr:|tj|fV  q|||fV  qW d S )N)r   r  r   EXTRA_KEYWORDSr   rB  )r  r6  indextokenvaluer&   r&   r'   r    s
    z!NumPyLexer.get_tokens_unprocessedc             C   s*   t | dsd| d d ko(d| kp(d| kS )Nzpythonw?(2(\.\d)?)?zimport i  zimport numpyzfrom numpy import)r   )r6  r&   r&   r'   r7    s    
zNumPyLexer.analyse_textN)r.  r,  r8  r(  r7   r9  r;  r:  r   r  r  r7  r&   r&   r&   r'   r    P  s   B))r(  r  Zpygments.lexerr   r   r   r   r   r   r   r	   r
   Zpygments.utilr   r   Zpygments.tokenr   r   r   r   r   r   r   r   r   r   r   Zpygmentsr   r  __all__r`   r  r   r   r   r   r   r   r   r    r&   r&   r&   r'   <module>
   s(   ,4
 Z  X'' 4c