HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyo
�
O;Mc@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	yddl
mZWn!ek
r�ddlmZnXddl
mZddlZejjd�Zeged D]"Zeejde�d�^q��Zed	�\ZZZejd
�Zejd�ZdZd
Zd�Zddl Z e j!d�ddd��YZ"e"�Z#d�Z$e%e$_&d�Z'd�Z(e)dkr�e(�ndS(i����N(tMatplotlibShell(tmd5(t
directivest.is[a-z]iisIn \[(\d+)\]:\s?(.*)\s*sOut\[(\d+)\]:\s?(.*)\s*sIn [%d]:sOut[%d]:cCsIg}|jd�}t|�}d}d
}x||kr@Pn||}|d7}|j�}|jd�r�|jt|f�q0n|jd�r�|}q0ntj|�}|r�t	|j
d��|j
d�}	}
ddjd	gtt|	��d�}t|�}g}
x}||kr�||}t
j|�}|sV|jd�rZPn1|j|�r~|
d||7}
n
|
j|�|d7}qW|jt||
dj|
�ff�q0nt
j|�}|r0t	|j
d��|j
d�}	}||dkr+dj|g||�}n|jt|f�Pq0q0|S(s�
    part is a string of ipython text, comprised of at most one
    input, one ouput, comments, and blank lines.  The block parser
    parses the text into a list of::

      blocks = [ (TOKEN0, data0), (TOKEN1, data1), ...]
    where TOKEN is one of [COMMENT | INPUT | OUTPUT ] and
    data is, depending on the type of token::

      COMMENT : the comment string

      INPUT: the (DECORATOR, INPUT_LINE, REST) where
         DECORATOR: the input decorator (or None)
         INPUT_LINE: the input as string (possibly multi-line)
         REST : any stdout generated by the input line (not OUTPUT)


      OUTPUT: the output string, possibly multi-line

    s
iit#t@is   %s:tRN(tsplittlentNonetstript
startswithtappendtCOMMENTtrgxintmatchtinttgrouptjointstrtrgxouttINPUTtOUTPUT(tparttblocktlinestNtit	decoratortlinet
line_strippedtmatchintlinenot	inputlinetcontinuationtNctresttnextlinetmatchouttoutput((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pytblock_parsersT

%*

%%tAggtEmbeddedSphinxShellcBs,eZd�Zd�Zd�Zd�ZRS(cCs�tj�|_|jtjj_|jtjj_ddg}i|_i|_tj	j
||j|jdtdtdt
dd��|_d|_d|_t|_t|_t|_t|_|jd	�|jjd
�|jjd
�dS(Ns	-autocallt0tembeddedtshell_classtrc_overridetcolorstNoColorRsbookmark ipy_basediri(t	cStringIOtStringIOtcouttIPythontShelltTermtcerrtuser_nstuser_glocal_nstipmakertmake_IPythontTrueRtdicttIPtinputR'tFalsetis_verbatimt
is_doctesttis_suppresst_pyplot_importedt
process_inputtseekttruncate(tselftargv((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyt__init__�s&									
cCsAtj}|jt_|jj|jj|d��|t_dS(s#process the input, capturing stdoutiN(tsyststdoutR3R>tpusht	prefilter(RHRRL((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyRE�s	c%Cs�g}d}d}tjt|jjj�j��}t|j	d��}t
|}t|}d}	d}
x�|D]�\}}|tkr�|j
s=|j|�q=qr|tkrh|\}
}}|
dkp�|j}|
dkp�|j}|
dkp�|j
}|
dk	o|
jd�}|jd�}ddjd	gtt|��d
�}t|�}|r|
jd�}|d}tjjd|�}d
|g}xV|d
D]J}|jd�\}}|j�}|j�}|jd||f�q�W|}	dj|�}
nt}x�t|�D]�\}}|jd�rJt}n|dkr�|rl|jd�n
|j|�d||f} n&|s�|j|�nd||f} |s&|j| �q&q&W|st|j��r|r|jd|�|jd�qqn|jjd�|jj�}|rU|rU|rU|j|�n|jj d�qr|t!krr|r�dt||f}|j|�n|r=|j�}!|}"|"dk	r:|"j"|�}#|#dkr�t#d||"f��n|"t|�j�}"|"|!kr7t#d||"|!f��q7q:q=qrqrW|	dk	r�|j$�d|	}$|jd�|jd�|j|$�|jd�|jjd�|jj d�n||
fS(sZ
        process block from the block_parser and return a list of processed lines
        is	@verbatims@doctests	@suppresss@savefigs
s   %s:RRit s
_static/%ss
.. image:: %st=s
   :%s: %st;is%s %ss%ss%s %s
s-output prompt="%s" does not match out line=%ssUdoctest failure for input_lines="%s" with found_output="%s" and submitted output="%s"splt.gcf().savefig("%s")sbookmark ipy_thisdirscd -b ipy_basedirscd -b ipy_thisdirN(%R	RRRR>toutputcachetprompt1R
RRtfmtintfmtoutR
RCRRRARBRRRRtostpathR@t	enumeratetendswithR<RER3RFtreadRGRtfindtRuntimeErrort
insure_pyplot(%RHRtretR'tinput_linestmR tinput_promptt
output_promptt
image_filetimage_directivettokentdataRR?R$RARBRCt
is_savefigR"R#tsaveargstfilenametoutfilet	imagerowstkwargtargtvaltis_semicolonRRtformatted_linet	submittedtfoundtindtcommand((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyt
process_block�s�$

	*

	
)





cCs|jr
dS|jd�dS(Nsimport matplotlib.pyplot as plt(RDRE(RH((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyR]Fs	(t__name__t
__module__RJRERuR](((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyR*�s	!		�c	Cs�tj}	|jd�t_|jd�t_|jd�t_dj|�jd�}
ddg}g}x�|
D]�}
t	|
�}t
|�rptj|�\}}x;|D]3}|jg|jd�D]}d|^q��q�W|dk	r|j|�qqpqpWx>|D]6}|jd�|j|jd��|jd�qWt
|�d	kr�|	rndj|�GHq�|j||jjd
��ngS(Ntsuppresstdoctesttverbatims
s

s.. sourcecode:: ipythonRs    %sii(tipython_directivetDEBUGthas_keytshellRCRBRARRR(RRutextendR	Rtinsert_inputR_tsource(tnamet	argumentstoptionstcontentR tcontent_offsett
block_texttstatet
state_machinetdebugtpartsRtfiguresRRtrowstfiguretrowR((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyR{Ps2	

1

cCsJ|t_itjd6tjd6tjd6}|jdttd|�dS(NRxRyRztipythonii(iii(tsetuptappRtflagt
add_directiveR{R<(R�R�((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyR�{s	


cCs�ddddddddd	d
dg}tt_t�}xW|D]O}|jd�}td
ddd|d|dddddddddd�q@WdS(Ns6
In [9]: pwd
Out[9]: '/home/jdhunter/py4science/book'

In [10]: cd bookdata/
/home/jdhunter/py4science/book/bookdata

In [2]: from pylab import *

In [2]: ion()

In [3]: im = imread('stinkbug.png')

@savefig mystinkbug.png width=4in
In [4]: imshow(im)
Out[4]: <matplotlib.image.AxesImage object at 0x39ea850>

s�

In [1]: x = 'hello world'

# string methods can be
# used to alter the string
@doctest
In [2]: x.upper()
Out[2]: 'HELLO WORLD'

@verbatim
In [3]: x.st<TAB>
x.startswith  x.strip
sV

In [130]: url = 'http://ichart.finance.yahoo.com/table.csv?s=CROX\
   .....: &d=9&e=22&f=2009&g=d&a=1&br=8&c=2006&ignore=.csv'

In [131]: print url.split('&')
--------> print(url.split('&'))
['http://ichart.finance.yahoo.com/table.csv?s=CROX', 'd=9', 'e=22', 'f=2009', 'g=d', 'a=1', 'b=8', 'c=2006', 'ignore=.csv']

In [60]: import urllib

s�\

In [133]: import numpy.random

@suppress
In [134]: numpy.random.seed(2358)

@doctest
In [135]: np.random.rand(10,2)
Out[135]:
array([[ 0.64524308,  0.59943846],
       [ 0.47102322,  0.8715456 ],
       [ 0.29370834,  0.74776844],
       [ 0.99539577,  0.1313423 ],
       [ 0.16250302,  0.21103583],
       [ 0.81626524,  0.1312433 ],
       [ 0.67338089,  0.72302393],
       [ 0.7566368 ,  0.07033696],
       [ 0.22591016,  0.77731835],
       [ 0.0072729 ,  0.34273127]])

s�
In [106]: print x
--------> print(x)
jdh

In [109]: for i in range(10):
   .....:     print i
   .....:
   .....:
0
1
2
3
4
5
6
7
8
9


s�

In [144]: from pylab import *

In [145]: ion()

# use a semicolon to suppress the output
@savefig test_hist.png width=4in
In [151]: hist(np.random.randn(10000), 100);


@savefig test_plot.png width=4in
In [151]: plot(np.random.randn(10000), 'o');
   s�
# use a semicolon to suppress the output
In [151]: plt.clf()

@savefig plot_simple.png width=4in
In [151]: plot([1,2,3])

@savefig hist_simple.png width=4in
In [151]: hist(np.random.randn(10000), 100);

s�
# update the current fig
In [151]: ylabel('number')

In [152]: title('normal distribution')


@savefig hist_with_text.png
In [153]: grid(True)

        sG

In [239]: 1/2
@verbatim
Out[239]: 0

In [240]: 1.0/2.0
Out[240]: 0.5
s5
@verbatim
In [6]: pwd
Out[6]: '/home/jdhunter/mypy'
s?
@verbatim
In [151]: myfile.upper?
Type:           builtin_function_or_method
Base Class:     <type 'builtin_function_or_method'>
String Form:    <built-in method upper of str object at 0x980e2f0>
Namespace:      Interactive
Docstring:
    S.upper() -> string
    Return a copy of the string S converted to uppercase.
 s
R�R�R�R�R iR�R�R�R�(R<R{R|R=RR	(texamplesR�texampleR�((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyttest�s&			
t__main__((*RKRVtshutiltimptwarningsR1treR4t
IPython.ShellRthashlibRtImportErrortdocutils.parsers.rstRtsphinxt__version__Rtsphinx_versionttupletxRtrangeR
RRtcompileRRRTRUR(t
matplotlibtuseR*R~R{R@R|R�R�Rv(((sY/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyt<module>s6T
3	d
�		)			�