diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-04-17 08:48:32 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-04-17 08:48:32 (GMT) |
commit | 9d72bb452bced3a100f07f8a9e30c4495a9ec41a (patch) | |
tree | c39762a764fcc16f2cfc42e2504e58ff31e159e6 /Lib/distutils/text_file.py | |
parent | ff11334927ee616d765b54a3851016b76a20bcec (diff) | |
download | cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.zip cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.gz cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.bz2 |
Remove functions in string module that are also string methods. Also remove:
* all calls to functions in the string module (except maketrans)
* everything from stropmodule except for maketrans() which is still used
Diffstat (limited to 'Lib/distutils/text_file.py')
-rw-r--r-- | Lib/distutils/text_file.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/distutils/text_file.py b/Lib/distutils/text_file.py index 10ee1be..c23a31d 100644 --- a/Lib/distutils/text_file.py +++ b/Lib/distutils/text_file.py @@ -7,7 +7,7 @@ lines, and joining lines with backslashes.""" __revision__ = "$Id$" from types import * -import sys, os, string +import sys, os class TextFile: @@ -142,7 +142,7 @@ class TextFile: else: outmsg.append("line %d: " % line) outmsg.append(str(msg)) - return string.join(outmsg, "") + return "".join(outmsg) def error (self, msg, line=None): @@ -196,7 +196,7 @@ class TextFile: # unescape it (and any other escaped "#"'s that might be # lurking in there) and otherwise leave the line alone. - pos = string.find (line, "#") + pos = line.find ("#") if pos == -1: # no "#" -- no comments pass @@ -219,11 +219,11 @@ class TextFile: # # comment that should be ignored # there # result in "hello there". - if string.strip(line) == "": + if line.strip () == "": continue else: # it's an escaped "#" - line = string.replace (line, "\\#", "#") + line = line.replace("\\#", "#") # did previous line end with a backslash? then accumulate @@ -235,7 +235,7 @@ class TextFile: return buildup_line if self.collapse_join: - line = string.lstrip (line) + line = line.lstrip () line = buildup_line + line # careful: pay attention to line number when incrementing it @@ -259,11 +259,11 @@ class TextFile: # strip whitespace however the client wants (leading and # trailing, or one or the other, or neither) if self.lstrip_ws and self.rstrip_ws: - line = string.strip (line) + line = line.strip () elif self.lstrip_ws: - line = string.lstrip (line) + line = line.lstrip () elif self.rstrip_ws: - line = string.rstrip (line) + line = line.rstrip () # blank line (whether we rstrip'ed or not)? skip to next line # if appropriate @@ -313,7 +313,7 @@ line 3 \\ continues on next line """ # result 1: no fancy options - result1 = map (lambda x: x + "\n", string.split (test_data, "\n")[0:-1]) + result1 = map (lambda x: x + "\n", test_data.split ("\n")[0:-1]) # result 2: just strip comments result2 = ["\n", @@ -340,7 +340,7 @@ line 3 \\ def test_input (count, description, file, expected_result): result = file.readlines () - # result = string.join (result, '') + # result = ''.join (result) if result == expected_result: print("ok %d (%s)" % (count, description)) else: |