Ñò ”tJc @s‘dZddkZddkZddkZddkZddkZddkZddkZddkZddk Z yddkl Z Wn#e j oddk l Z nXddk l Z yddklZWn,e j o ddklZeiZnXddklZddkZeiidƒZegZed D]#Zeee id eƒd ƒq?[ƒZddkZddkiZeid ƒddki Z!ddk"i#Z#dd kl$Z$ddk%Z%e&ei'dƒoei'i(Z(nei)d„Z(d„Z*he i+d6e i,d6e i-d6e i.d6ed6e i/d6e i0d6Z1dZ2dZ3d„Z4d„Z5d„Z6d„Z7d„Z8dS(sIA special directive for including a matplotlib plot. Given a path to a .py file, it includes the source code inline, then: - On HTML, will include a .png with a link to a high-res .png. - On LaTeX, will include a .pdf This directive supports all of the options of the `image` directive, except for `target` (since plot will add its own target). Additionally, if the :include-source: option is provided, the literal source will be included inline, as well as a link to the source. The set of file formats to generate can be specified with the plot_formats configuration variable. iÿÿÿÿN(tmd5(t directives(talign(tImage(tnodest.is[a-z]itAgg(t_pylab_helperstrelpathcCsXtii|ƒptd|‚ntii|ƒptd|‚ntii|ƒitiƒ}tii|ƒitiƒ}tid joB|d|djo-td|di ƒd|di ƒ‚nxMt t t |ƒt |ƒƒƒD] }||||joPqøqøW|d 7}ti gt |ƒ|||}tii|ŒS( sÄ Return a relative path to the target from either the current dir or an optional base dir. Base can be a directory specified either as absolute or relative to current dir. sTarget does not exist: s+Base is not a directory or does not exist: tnttdostos2is0Target is on a different drive to base. Target: s, base: i(sntR R (tostpathtexiststOSErrortisdirtabspathtsplittseptnametuppertrangetmintlentpardirtjoin(ttargettbaset base_listt target_listtitrel_list((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pyR6s%-"  "cCs!tii|ƒtiiƒdS(N(tsyststdouttwritetflush(ts((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pyt write_charVstalttheighttwidthtscaleRtclasssinclude-sources´ .. htmlonly:: [%(links)s] .. image:: %(prefix)s%(tmpdir)s/%(outname)s.png %(options)s .. latexonly:: .. image:: %(prefix)s%(tmpdir)s/%(outname)s.pdf %(options)s sh .. htmlonly:: [`source code <%(linkdir)s/%(basename)s.py>`__] Exception occurred rendering plot. cCstii|ƒ S(sh Returns True if derivative is out-of-date wrt original, both of which are full file paths. (R R R(toriginaltderived((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pyt out_of_datexsc CsÄtiƒ}tii|ƒ\}}tiidtii|ƒƒti}ti ƒt_ti |ƒz4t |ƒ}t i d||ddt ifƒ}Wdtid=ti |ƒ|t_X|S(s- Import a Python module from a path. it__main__tpytrN(R tgetcwdR RR!tinsertRR"t cStringIOtStringIOtchdirtopentimpt load_modulet PY_SOURCE(tfullpathtpwdR tfnameR"tfdtmodule((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pytrunfile€s    (   cBsÿdddg}e|ƒ}eii|ƒ\}}eii|ƒ\}}e|ƒdjodd k}|iƒne} xN|D]F\} } eii|d || fƒ} e || ƒo e } Pq…q…W| oe d e |ƒƒd Sd } x|eote} xQ|D]I\} } eii|d|| | fƒ} e || ƒo e } Pq q W| o| d 7} qøPqøW| d joe d | e |ƒƒ| Se idƒeiƒdeid<|d j o |d Un:ye|ƒWn(eid|ƒ}ei|ƒd SXeiiƒ}xÏe|ƒD]Á\} }x²|D]ª\} } e |ƒd jo |} nd|| f} eii|d | | fƒ}y|iii|d| ƒWn(eid|ƒ}ei|ƒd SXe dƒqCWq0We |ƒS(sU run a pyplot script and save the low and high res PNGs and a PDF in _static tpngiPs hires.pngiÈtpdfi2tNoneiÿÿÿÿNs%s.%sRiis %s_%02d.%stallg@g@sfigure.figsizesException running plot %ss%s_%02dtdpit*(RAiP(s hires.pngiÈ(RBi2(g@g@(tstrR R Rtsplitexttpdbt set_tracetTrueRR.tFalseR&Rtplttcloset matplotlibt rcdefaultstrcParamsRCR@tcbooktexception_to_strtwarningstwarnRtGcftget_all_fig_managerst enumeratetcanvastfiguretsavefig(R;tcodetoutdirtformatstbasedirR=tbasenametextRIt all_existstformatREtoutnameRR%t fig_managerstfigmantoutpath((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pytmakefig•sz     "            c &CsÆtii} t| ƒtjot| ƒ} nt|ƒdjo‚ti|dƒ} t i i | ƒ\} } t i i | ƒ\} }t | tiiiƒ} t|ƒotdƒ‚nd}n6d} di|ƒ}t|ƒiƒd} } d} t i i |iidƒ\}}|ttiƒd}g}t i i |ƒD]}|iƒo ||qIqI~}t|ƒ}t i id| ƒ}d ||}t i id |ƒ}tdjot i i|ƒ}d }nd }t i i|ƒpti|ƒnt i it i itiii|ƒƒ}t i i|ƒpti|ƒnt | ||ƒ}|i!dƒoo|djot"| dƒi#ƒ}ndd gg}|i dƒD]}|d|i$ƒqº~}|d=ng}|djog}|i%ƒD]\} }!|d| |!fq ~}di|ƒ}| dj o#t&i'| t i i|| ƒƒnx#t(|ƒD]ô}"|djo | }#nd| |"f}#g}$| dj o|$i)dƒnxm| dD]a}%t&i't i i||#d|%ƒt i i||#d|%ƒƒ|$i)d|%||#|%fƒqØWdi|$ƒt*ƒ}$|i+t,t*ƒi dƒƒq|Wn|i+t-t*ƒi dƒƒt|ƒo |i.||i/i0dƒƒngS(s$ Handle the plot directive. iisAplot directive may not specify both a filename and inline contenttinlines iöÿÿÿtsourcetplot_directives../tbuilditt/sinclude-sourceR1s::s %ss :%s: %ss%s_%02ds-`source code <%(linkdir)s/%(basename)s.py>`__Rs`%s <%s/%s.%s>`__s, N(ii(1tsetuptconfigt plot_formatsttypeRGtevalRRturiR R RRHRtapptbuildertsrcdirt ValueErrorRCRRt hexdigesttdocumentt attributestconfdirtstriptsphinx_versionRRRRtmkdirsR]Rhthas_keyR7treadtrstriptitemstshutiltcopyfileRtappendtlocalstextendttemplatetexception_templatet insert_inputt input_linesRj(&Rt argumentstoptionstcontenttlinenotcontent_offsett block_texttstatet state_machineR^t referenceR_R=R`Ratrstdirtrstfiletreldirt_[1]tptrelpartstnpartsR]tlinkdirttmpdirtprefixtdestdirtnum_figst_[2]trowtlinest_[3]tkeytvalRRdtlinksRc((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pyRkçs€   ">    * >  0 #      !% cCsZ|t_|it_|it_|idttdt|iddddgtƒdS( NtplotiiRqRAs hires.pngRB(iii( RoRuRpR|t add_directiveRkRKRŽtadd_config_value(Ru((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pyRoQs    (9t__doc__R!R tglobR„thashlibR8RTR4treRt ImportErrortdocutils.parsers.rstRt&docutils.parsers.rst.directives.imagesRRtdocutilsRtsphinxt __version__RR~ttupleR™txtintROtmatplotlib.cbookRRtusetmatplotlib.pyplottpyplotRMtmatplotlib.imagetimageRtonly_directivesthasattrR RtcurdirR&t unchangedtlength_or_unitlesst length_or_percentage_or_unitlesstnonnegative_intt class_optiontflagRŽR‰RŠR.R@RhRkRo(((sI/usr/lib64/python2.6/site-packages/matplotlib/sphinxext/plot_directive.pytsT`   7              R j