ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ ]c @sdZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ej jeZej jej jej jeZdZdZedZdZd Zded d Zdadad Zd ZdZdZ dZ!dZ"dZ#dddZ$dZ%dZ&dZ'dej(fdYZ)e*dkrej+drej+ddkrej,ej-neej krej j.enxej+dD]Z/ej je/Z/e/e_0ej1e/dedej2ej3Bde)ej j4e/d dZ5e5e/ks~t6ej7d e/e5fqWndS(!s> These are functions for use when doctest-testing a document. iN(tStringIO(t PySourceColorcCst|}|r|GHndS(N(trun_raw(tcommandtdata((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytruns c Cstj|dtdtjdtjdt}|jj}|jx,|j dsj|j drw|d }qLW|rdj g|j D]}|r|^q}|SdSd S( s6 Runs the string command, returns any output. tshelltstderrtstdouttenvs s itN( t subprocesstPopentTruetSTDOUTtPIPEt _make_envRtreadtwaittendswithtjoint splitlines(RtprocRtl((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyRs  !(cCsMt|}d||f}td|ddd||rI|rI|GHndS(Ns$ %s %ss shell-commandt descriptionsshell transcriptR(Rt show_file(Rtnamet and_printtoutputR((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyt run_command1s   cCs~tjj}|jdddtjjtddtjjtdddd|d<|jdddt|d<|S( NtPATHR t:tscriptstpastes 3rd-partyssqlobject-filest PYTHONPATH(tostenvirontcopytgettpathRt paste_parent(R ((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyR9s <cCstj|tdS(s. Clears (deletes) the given directory N(tshutiltrmtreeR (tdir((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyt clear_dirFsic Cs|ptj}tj|}|jx|D]}tjj||}tjj|rl|d}nd||GHtjj|r2|r2td|dtd|dq2q2WdS(s" Show a directory listing t/t R+trecursetindentiN( R#tgetcwdtlistdirtsortR'RtisdirtlsR (R+R/R0tfnstfntfull((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyR5Ls    cCs|a|adS(N(t default_appt default_url(tappturl((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytset_default_app^scCsGtjjtjjtjdtjjtjjtjd|S(sj Returns the filename of the resource -- generally in the directory resources/DocumentName/fn t resourcesi(R#R'Rtdirnametsysttesting_document_filenametsplitexttbasename(R7((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytresource_filenameds  "cCst|d}t}tdk s1tdt|}|jd||f|jdtjdddd|gd tj d tj d t }|j \}}t|}t j |}|j} x|jD]\} } | jd krt| jd dkrqn| jdkr7qn| jdkr^| jdr^qn|jd| | fqWg| jD]} | jr| ^q} x| D]}|j|dqW|r|jd|n|jd|j}tjj|s4t|d}|j||jnjt|d}|j}|jt||sd|GHddGH|GHddGHdGHddGH|GHndS(Ns.htmlsNo default_app sets9%s
s
tpastersserve--server=consoles --no-verboses--url=RRR tstatusiis content-typescontent-lengths set-cookiet_SID_s/%s: %s
s s$
%s
s
twbtrbs'Pages did not match. Expected from %s:t-i<t=sActual output:(s content-typescontent-length(RDRR9tNonetAssertionErrorR:twriteR R RRt communicatetrfc822tMessageRtitemstlowertinttsplitt startswithRtstriptgetvalueR#R'texiststopentcloset html_matches(t path_infot example_nameR7toutR<RRterrorstheaderstcontenttheadertvalueRtlinestlinetresulttftexpected((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytshowosf            . +             cCsPtj|}|jdd}tjdd|}d|}tj||S(Ns\.\.\.s.*s 0x[0-9a-f]+s^%s$(tretescapetreplacetsubtsearch(tpatternttexttregex((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyR\s  cCs|jdr|d}n|j}g}x=|D]5}|jdkr]|jdq5|j|q5Wdj|d}|S(Ns it.R (RVRtrstriptappendR(RRet new_linesRf((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytconvert_docstring_strings   cCs*t|}t||t||dS(N(Rwt write_dataR(R'tversionR((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyt create_files  cCst|}t|d}|j||j|jdrp|d}tjj|rptj|qpnt ||dd|d|dS(Ntas.pytcRs added to %sR( RwRZRNR[RR#R'RYtunlinkR(R'RyRRhtpyc_file((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytappend_to_files    cCstjj|d}|dkrJt|d}|j}|jn|dkrrdtj|tj }ndt j |d}d|p||f}t t d||f|dS(NiRIs.pys!
%s
s!
%s
s-%s
%ss%s.%s.gen.html(R#R'RBRLRZRR[Rtstr2htmltdarktcgiRlRxRD(R'RyRRtextRhthtml((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyRs    cCsZtjddddd|gdtdtj}|j|\}}|}|j|S(Nssource-highlights--out-format=htmls--no-docs --css=nones --src-lang=%sRR(R R tFalseRROR(tinputtformatRRRRg((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytcall_source_highlights   cCsjtjjtjj|}tjj|s@tj|nt|d}|j||jdS(NRH( R#R'R?tabspathRYtmakedirsRZRNR[(R'RR+Rh((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyRxs  cCsttjj|d}|j}|jxh|D]`\}}}|dkrf|g|||+q8|dkrg|||+q8ds8td|q8Wt|d}|jdj||jdS(NRItinserttdeleteisUnknown change_type: %rRHR ( RZR#R'Rt readlinesR[RMRNR(R'tchangesRhRet change_typeRfRq((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyt change_files     tLongFormDocTestParsercBs?eZdZejdejejBZdZddZ RS(s This parser recognizes some reST comments as commands, without prompts or expected output, like: .. run: do_this(... ...) s # Source consists of a PS1 line followed by zero or more PS2 lines. (?: (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*)) | (?: # This is for longer commands that are prefixed with a reST # comment like '.. run:' (two colons makes that a directive). # These commands cannot have any output. (?:^\.\.[ ]*(?Prun):[ ]*\n) # Leading command/command (?:[ ]*\n)? # Blank line following (?P (?:(?P [ ]+)[^ ].*$) (?:\n [ ]+ .*)*) ) | (?: # This is for shell commands (?P (?:^(P [ ]*) [$] .*) # Shell line (?:\n [ ]* [>] .*)*) # Continuation \n? # Want consists of any non-blank lines that do not start with $ (?P (?:(?![ ]*$) (?![ ]*[$]$) .*$\n? )*)) cCs|jdpd}t|jd|}|jd|jd}|rq|j|dd|||n8|j|||||j|dd|d |||rdjg|D]}||^q}n*djg|D]}||d ^q}|rd} d} n|jd } | jd} t| dkrgtjd | d rg| d =n|j| d|||t|djg| D]} | |^q} |j j| }|r|jd} nd} |j |||} || | | fS(s? Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. >>> def parseit(s): ... p = LongFormDocTestParser() ... return p._parse_example(p._EXAMPLE_RE.search(s), '', 1) >>> parseit('>>> 1\n1') ('1', {}, '1', None) >>> parseit('>>> (1\n... +1)\n2') ('(1\n+1)', {}, '2', None) >>> parseit('.. run:\n\n test1\n test2\n') ('test1\ntest2', {}, '', None) RR s%sindents%ssources iR.iRsitwants *$itmsgN( tgrouptlenRUt _check_prefixt_check_prompt_blankRRLRktmatcht _EXCEPTION_REt _find_options(tselftmRtlinenotrunnerR0t source_linestsltsourceRtexc_msgt want_linestwltoptions((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyt_parse_example2s4!")* ( &sc Cs|j}|j|}|dkrYdjg|jdD]}||^q=}ng}d\}}x|jj|D]}|j|||j!||jd||j7}|j |||\} } } } |j | s@|jt j | | | d|d|t |jdp,|jdd| n||jd|j|j7}|j}q~W|j|||S(s= Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. is RR0t runindentR(ii(t expandtabst _min_indentRRUt _EXAMPLE_REtfinditerRutstarttcountRt_IS_BLANK_OR_COMMENTtdoctesttExampleRRtend( RtstringRt min_indentRRtcharnoRRRRRR((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytparsets(  2 !  ( %( t__name__t __module__t__doc__Rktcompilet MULTILINEtVERBOSERRR(((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pyRs  " Bt__main__iRtmodule_relativet optionflagstparsers.htmlsrst2html.py %s > %s(8RR RR#R@R)RkRRPt cStringIORt paste.utilRR'Rt__file__thereR?R(RRRRRR,RLR5R9R:R=RDRjR\RwRzRRRRxRt DocTestParserRRtargvttestmodtexitRuR7RAttestfiletELLIPSIStREPORT_ONLY_FIRST_FAILURERBtnewRMtsystem(((sK/opt/alt/python27/lib/python2.7/site-packages/paste/debug/doctest_webapp.pytsb         !      6