[Docstring-checkins] CVS: dps/dps statemachine.py,1.5,1.6
Status: Pre-Alpha
Brought to you by:
goodger
From: David G. <go...@us...> - 2001-08-25 01:47:50
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv8412/dps/dps Modified Files: statemachine.py Log Message: - Added form feed & vertical tab conversion to string2lines. Index: statemachine.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/statemachine.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** statemachine.py 2001/08/23 03:59:03 1.5 --- statemachine.py 2001/08/25 01:47:48 1.6 *************** *** 109,113 **** 'UnexpectedIndentationError', 'string2lines', 'extractindented'] ! import sys, re --- 109,113 ---- 'UnexpectedIndentationError', 'string2lines', 'extractindented'] ! import sys, re, string *************** *** 931,935 **** ! def string2lines(astring, tabwidth=8): """ Return a list of one-line strings with tabs expanded and no newlines. --- 931,937 ---- ! _whitespace_conversion_table = string.maketrans('\v\f', ' ') ! ! def string2lines(astring, tabwidth=8, convertwhitespace=0): """ Return a list of one-line strings with tabs expanded and no newlines. *************** *** 942,946 **** --- 944,951 ---- - `astring`: a multi-line string. - `tabwidth`: the number of columns between tab stops. + - `convertwhitespace`: convert form feeds and vertical tabs to spaces? """ + if convertwhitespace: + astring = astring.translate(_whitespace_conversion_table) return [s.expandtabs(tabwidth) for s in astring.splitlines()] |