Package SCons :: Package compat :: Module _scons_textwrap
[hide private]
[frames] | no frames]

Module _scons_textwrap

source code

Text wrapping and filling.
Classes [hide private]
  unicode
  TextWrapper
Object for wrapping/filling text.
Functions [hide private]
 
wrap(text, width=70, **kwargs)
Wrap a single paragraph of text, returning a list of wrapped lines.
source code
 
fill(text, width=70, **kwargs)
Fill a single paragraph of text, returning a new string.
source code
 
dedent(text)
dedent(text : string) -> string
source code
Variables [hide private]
  __revision__ = '$Id: textwrap.py,v 1.32.8.2 2004/05/13 01:48:1...
  _whitespace = '\t\n\x0b\x0c\r '
  __package__ = 'SCons.compat'
Function Details [hide private]

wrap(text, width=70, **kwargs)

source code 

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.

fill(text, width=70, **kwargs)

source code 

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.

dedent(text)

source code 
dedent(text : string) -> string

    Remove any whitespace than can be uniformly removed from the left
    of every line in `text`.

    This can be used e.g. to make triple-quoted strings line up with
    the left edge of screen/whatever, while still presenting it in the
    source code in indented form.

    For example:

        def test():
            # end first line with \ to avoid the empty line!
            s = '''            hello
              world
            '''
            print repr(s)          # prints '    hello
      world
    '
            print repr(dedent(s))  # prints 'hello
  world
'
    


Variables Details [hide private]

__revision__

Value:
'$Id: textwrap.py,v 1.32.8.2 2004/05/13 01:48:15 gward Exp $'