summaryrefslogtreecommitdiff
path: root/text_file.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-12-06 20:51:35 +0000
committerFred Drake <fdrake@acm.org>2001-12-06 20:51:35 +0000
commit68cb7fe9ae037b7a517b692213c03c6c0e54f7e4 (patch)
treea727fd4103af0be7bfecc4c982f47c3c9a7d78c6 /text_file.py
parent1a4ad0259c7382d0520aa9dad7e6af852b3d7ad9 (diff)
downloadpython-setuptools-git-68cb7fe9ae037b7a517b692213c03c6c0e54f7e4.tar.gz
Whitespace normalization.
Diffstat (limited to 'text_file.py')
-rw-r--r--text_file.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/text_file.py b/text_file.py
index 37bffe61..7086b1af 100644
--- a/text_file.py
+++ b/text_file.py
@@ -86,7 +86,7 @@ class TextFile:
if filename is None and file is None:
raise RuntimeError, \
- "you must supply either or both of 'filename' and 'file'"
+ "you must supply either or both of 'filename' and 'file'"
# set values for all options -- either from client option hash
# or fallback to default_options
@@ -113,7 +113,7 @@ class TextFile:
# actually read from the file; it's only populated by an
# 'unreadline()' operation
self.linebuf = []
-
+
def open (self, filename):
"""Open a new file named 'filename'. This overrides both the
@@ -213,7 +213,7 @@ class TextFile:
# EOF; I think that's OK.)
eol = (line[-1] == '\n') and '\n' or ''
line = line[0:pos] + eol
-
+
# If all that's left is whitespace, then skip line
# *now*, before we try to join it to 'buildup_line' --
# that way constructs like
@@ -226,7 +226,7 @@ class TextFile:
else: # it's an escaped "#"
line = string.replace (line, "\\#", "#")
-
+
# did previous line end with a backslash? then accumulate
if self.join_lines and buildup_line:
@@ -256,7 +256,7 @@ class TextFile:
self.current_line = self.current_line[1] + 1
else:
self.current_line = self.current_line + 1
-
+
# strip whitespace however the client wants (leading and
# trailing, or one or the other, or neither)
@@ -351,7 +351,7 @@ line 3 \\
print expected_result
print "** received:"
print result
-
+
filename = "test.txt"
out_file = open (filename, "w")
@@ -382,4 +382,3 @@ line 3 \\
test_input (6, "join lines with collapsing", in_file, result6)
os.remove (filename)
-