³ò žl‡Jc@sFdZdZddkTddkZddkZddkZdfd„ƒYZedjoèdZe d „ei ed ƒd d!ƒZ d d d gZ dd dd gZ ddgZdgZdgZd„ZdZeedƒZeieƒeiƒeedd dd dd dd ƒZeddee ƒeedddd dd dd ƒZeddee ƒeedd dddd dd ƒZedd ee ƒeeƒZed!d"eeƒeeddddd#dddƒZed$d%eeƒeeddddd#dddd&dƒZed'd(eeƒeieƒndS()s¼text_file provides the TextFile class, which gives an interface to text files that (optionally) takes care of stripping comments, ignoring blank lines, and joining lines with backslashes.s8$Id: text_file.py 29687 2002-11-14 02:25:42Z akuchling $iÿÿÿÿ(t*NtTextFilecBsªeZdZhdd<dd<dd<dd<dd<ddg}x1|iƒ}|djo|Sn|i|ƒq dS(sWRead and return the list of all logical lines remaining in the current file.N(R.RR(RtlinesR$((s&/sys/lib/python/distutils/text_file.pyt readlines s   cCs|ii|ƒdS(s·Push 'line' (a string) onto an internal buffer that will be checked by future 'readline()' calls. Handy for implementing a parser with line-at-a-time lookahead.N(RR(RR$((s&/sys/lib/python/distutils/text_file.pyt unreadline,sN(t__name__t __module__t__doc__R RRRRR&R(R,R.R8R9(((s&/sys/lib/python/distutils/text_file.pyR s 8      %  ~ t__main__sE# test file line 3 \ # intervening comment continues on next line cCs|dS(s ((tx((s&/sys/lib/python/distutils/text_file.pyt<ss is line 3 \ s continues on next line s # test file s# intervening comment sline 3 \s continues on next linesline 3 continues on next linesline 3 continues on next linecCsS|iƒ}||jod||fGHn$d||fGHdGH|GHdGH|GHdS(Ns ok %d (%s)snot ok %d (%s):s ** expected:s ** received:(R8(tcountt descriptionRtexpected_resulttresult((s&/sys/lib/python/distutils/text_file.pyt test_inputUs  stest.txttwRRRRis no processingisstrip commentsis strip blanksisdefault processingRisjoin lines without collapsingRisjoin lines with collapsing(R<t __revision__ttypesR)tosR!RR:t test_datatmaptsplittresult1tresult2tresult3tresult4tresult5tresult6RDRRtout_fileR+Rtin_filetremove(((s&/sys/lib/python/distutils/text_file.pyssT $ÿ( %