ó zfc@sģdZdZddlZddlZy eZWn'ek rWdefd„ƒYZnXdddd gZd Z dfd „ƒYZ d d „Z d d„Z ej dejƒZej dejƒZd„ZedkrčedƒGHndS(sText wrapping and filling. s$Id$i’’’’Nt_unicodecBseZRS((t__name__t __module__(((s /usr/lib64/python2.7/textwrap.pyRst TextWrappertwraptfilltdedents c Bs÷eZdZejedeeƒƒZiZe dƒZ x!e e eƒD]Z e ee string Munge whitespace in text: expand tabs and convert all other whitespace characters to spaces. Eg. " foo\tbar\n\nbaz" becomes " foo bar baz". ( R t expandtabsR t isinstancetstrt translatetwhitespace_transRtunicode_whitespace_trans(Rttext((s /usr/lib64/python2.7/textwrap.pyt_munge_whitespace’s  cCspt|tƒr0|jr$|j}qN|j}n|jrE|j}n |j}|j|ƒ}td|ƒ}|S(sN_split(text : string) -> [string] Split the text to wrap into indivisible chunks. Chunks are not quite the same as words; see _wrap_chunks() for full details. As an example, the text Look, goof-ball -- use the -b option! breaks into the following chunks: 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ', 'use', ' ', 'the', ' ', '-b', ' ', 'option!' if break_on_hyphens is True, or in: 'Look,', ' ', 'goof-ball', ' ', '--', ' ', 'use', ' ', 'the', ' ', '-b', ' ', option!' otherwise. N( RRRRRRRtsplittfiltertNone(RR"tpattchunks((s /usr/lib64/python2.7/textwrap.pyt_split£s      cCs|d}|jj}xc|t|ƒdkrw||ddkrj|||ƒrjd||d<|d7}q|d7}qWdS(sg_fix_sentence_endings(chunks : [string]) Correct for sentence endings buried in 'chunks'. Eg. when the original text contains "... foo.\nBar ...", munge_whitespace() and split() will convert that to [..., "foo.", " ", "Bar", ...] which has one too few spaces; this method simply changes the one space to two. iiRs iN(tsentence_end_retsearchtlen(RR(tit patsearch((s /usr/lib64/python2.7/textwrap.pyt_fix_sentence_endingsĄs  $ cCsr|dkrd}n ||}|jrR|j|d| ƒ|d||d [string] Wrap a sequence of text chunks and return a list of lines of length 'self.width' or less. (If 'break_long_words' is false, some lines may be longer than this.) Chunks correspond roughly to words and the whitespace between them: each chunk is indivisible (modulo 'break_long_words'), but a line break can come between any two chunks. Chunks should not have internal whitespace; ie. a chunk is either all whitespace or a "word". Whitespace chunks will be removed from the beginning and end of lines, but apart from that whitespace is preserved. isinvalid width %r (must be > 0)i’’’’R( R t ValueErrortreverseR R R,RtstripR0R1R6tjoin(RR(tlinesR3R4tindentR tl((s /usr/lib64/python2.7/textwrap.pyt _wrap_chunksós4     %   % !cCsD|j|ƒ}|j|ƒ}|jr7|j|ƒn|j|ƒS(s^wrap(text : string) -> [string] Reformat the single paragraph in 'text' so it fits in lines of no more than 'self.width' columns, and return a list of wrapped lines. Tabs in 'text' are expanded with string.expandtabs(), and all other whitespace characters (including newline) are converted to space. (R#R)RR/R>(RR"R(((s /usr/lib64/python2.7/textwrap.pyR<s  cCsdj|j|ƒƒS(sŽfill(text : string) -> string Reformat the single paragraph in 'text' to fit in lines of no more than 'self.width' columns, and return a new string containing the entire wrapped paragraph. s (R:R(RR"((s /usr/lib64/python2.7/textwrap.pyRKs(RRt__doc__tstringt maketranst _whitespaceR,R R!tordtuspacetmaptxRRRRt lowercaseR*tTruetFalseRR#R)R/R6R>RR(((s /usr/lib64/python2.7/textwrap.pyR(s6(         ! I iFcKstd||}|j|ƒS(sČWrap a single paragraph of text, returning a list of wrapped lines. Reformat the single paragraph in 'text' so it fits in lines of no more than 'width' columns, and return a list of wrapped lines. By default, tabs in 'text' are expanded with string.expandtabs(), and all other whitespace characters (including newline) are converted to space. See TextWrapper class for available keyword args to customize wrapping behaviour. R (RR(R"R tkwargstw((s /usr/lib64/python2.7/textwrap.pyRWs cKstd||}|j|ƒS(s–Fill a single paragraph of text, returning a new string. Reformat the single paragraph in 'text' to fit in lines of no more than 'width' columns, and return a new string containing the entire wrapped paragraph. As with wrap(), tabs are expanded and other whitespace characters converted to space. See TextWrapper class for available keyword args to customize wrapping behaviour. R (RR(R"R RJRK((s /usr/lib64/python2.7/textwrap.pyRds s^[ ]+$s(^[ ]*)(?:[^ ])cCsHd}tjd|ƒ}tj|ƒ}x£|D]›}|dkrI|}q.|j|ƒr[q.|j|ƒrs|}q.xStt||ƒƒD],\}\}}||kr‰|| }Pq‰q‰W|t|ƒ }q.Wdr"|r"xF|j dƒD]2}| sé|j|ƒsét d||fƒ‚qéWn|rDt jd|d|ƒ}n|S(s{Remove any common leading whitespace from every line in `text`. This can be used to make triple-quoted strings line up with the left edge of the display, while still presenting them in the source code in indented form. Note that tabs and spaces are both treated as whitespace, but they are not equal: the lines " hello" and "\thello" are considered to have no common leading whitespace. (This behaviour is new in Python 2.5; older versions of this module incorrectly expanded tabs before searching for common leading whitespace.) Entirely blank lines are normalized to a newline character. Ris sline = %r, margin = %rs(?m)^N( R&t_whitespace_only_retsubt_leading_whitespace_retfindallt startswitht enumeratetzipR,R$tAssertionErrorR(R"tmargintindentsR<R-RFtytline((s /usr/lib64/python2.7/textwrap.pyRvs,    (   t__main__s Hello there. This is indented.(R?t __revision__R@RtunicodeRt NameErrortobjectt__all__RBRRRRt MULTILINERLRNRR(((s /usr/lib64/python2.7/textwrap.pyts"    ’0  6