• File: ipython_console_highlighting.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pyc
  • Date Modified: 07/22/2015 11:41 PM
  • File size: 3.24 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

]3Lc@sdZddlZddlmZmZddlmZmZmZddl	m
Z
mZddlm
Z
ejdZdefd	YZd
Zee
jd<dS(sreST directive for syntax-highlighting ipython interactive sessions.

XXX - See what improvements can be made based on the new (as of Sept 2009)
'pycon' lexer for the python console.  At the very least it will give better
highlighted tracebacks.
iN(tLexert
do_insertions(tPythonConsoleLexertPythonLexertPythonTracebackLexer(tCommenttGeneric(thighlightings.*?
tIPythonConsoleLexercBskeZdZdZdgZdgZejdZejdZ	ejdZ
ejdZdZRS(	sN
    For IPython console output or doctests, such as:

    .. sourcecode:: ipython

      In [1]: a = 'foo'

      In [2]: a
      Out[2]: 'foo'

      In [3]: print a
      foo

      In [4]: 1 / 0

    Notes:

      - Tracebacks are not currently supported.

      - It assumes the default IPython prompts, not customized ones.
    sIPython console sessiontipythonstext/x-ipython-consoles(In \[[0-9]+\]: )|(   \.\.\.+:)s(Out\[[0-9]+\]: )|(   \.\.\.+:)s   \.\.\.+:s\-+ccs?t|j}t|j}d}g}xtj|D]}|j}|jj|}|jj|j	}	|j
j|}
|jdr|jt
|dt|fgfq:|dk	r|jt
|dtj|jfgf|||j7}q:|	dk	ra|jt
|dtj|	jfgf|||	j7}q:|
dk	r|jt
|dtj|
jfgf|||
j7}q:|rx4t||j|D]}|Vd}g}qWn|jtj|fVq:W|r;x(t||j|D]}|Vq)WndS(Ntt#i(RtoptionsRtline_retfinditertgrouptinput_prompttmatchtcontinue_prompttrstript
output_promptt
startswithtappendtlenRtNoneRtPrompttendtErrorRtget_tokens_unprocessedtstarttOutput(tselfttexttpylexerttblexertcurcodet
insertionsRtlineRRRtitem((sd/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pyR<sF	
	(
t__name__t
__module__t__doc__tnametaliasest	mimetypestretcompileRRRttb_startR(((sd/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pyRs		cCsdS(sSetup as a sphinx extension.N((tapp((sd/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pytsetupgsR	(R)R-tpygments.lexerRRtpygments.lexers.agileRRRtpygments.tokenRRtsphinxRR.R
RR1tlexers(((sd/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pyt<module>sJ