[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-29]
fix some docs and BufferedFile.readline fix some documentation and fix readline()'s universal newline support to always return strings ending with '\n', regardless of how they were in the original file. (this is an obvious feature of python's universal newline support that i somehow missed before.)
This commit is contained in:
parent
c565d66e39
commit
9f6bbb6519
|
@ -59,7 +59,7 @@ class BufferedFile (object):
|
||||||
file. This iterator happens to return the file itself, since a file is
|
file. This iterator happens to return the file itself, since a file is
|
||||||
its own iterator.
|
its own iterator.
|
||||||
|
|
||||||
@raise: ValueError if the file is closed.
|
@raise ValueError: if the file is closed.
|
||||||
|
|
||||||
@return: an interator.
|
@return: an interator.
|
||||||
@rtype: iterator
|
@rtype: iterator
|
||||||
|
@ -90,7 +90,7 @@ class BufferedFile (object):
|
||||||
EOF is hit. Unlike python file objects, it's okay to mix calls to
|
EOF is hit. Unlike python file objects, it's okay to mix calls to
|
||||||
C{next} and L{readline}.
|
C{next} and L{readline}.
|
||||||
|
|
||||||
@raise: StopIteration when the end of the file is reached.
|
@raise StopIteration: when the end of the file is reached.
|
||||||
|
|
||||||
@return: a line read from the file.
|
@return: a line read from the file.
|
||||||
@rtype: string
|
@rtype: string
|
||||||
|
@ -161,7 +161,7 @@ class BufferedFile (object):
|
||||||
EOF is encountered immediately.
|
EOF is encountered immediately.
|
||||||
|
|
||||||
@note: Unlike stdio's C{fgets()}, the returned string contains null
|
@note: Unlike stdio's C{fgets()}, the returned string contains null
|
||||||
characters (C{'\0'}) if they occurred in the input.
|
characters (C{'\\0'}) if they occurred in the input.
|
||||||
|
|
||||||
@param size: maximum length of returned string.
|
@param size: maximum length of returned string.
|
||||||
@type size: int
|
@type size: int
|
||||||
|
@ -218,7 +218,7 @@ class BufferedFile (object):
|
||||||
xpos += 1
|
xpos += 1
|
||||||
self._rbuffer = line[xpos:]
|
self._rbuffer = line[xpos:]
|
||||||
lf = line[pos:xpos]
|
lf = line[pos:xpos]
|
||||||
line = line[:xpos]
|
line = line[:pos] + '\n'
|
||||||
if (len(self._rbuffer) == 0) and (lf == '\r'):
|
if (len(self._rbuffer) == 0) and (lf == '\r'):
|
||||||
# we could read the line up to a '\r' and there could still be a
|
# we could read the line up to a '\r' and there could still be a
|
||||||
# '\n' following that we read next time. note that and eat it.
|
# '\n' following that we read next time. note that and eat it.
|
||||||
|
@ -286,7 +286,7 @@ class BufferedFile (object):
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
"""
|
"""
|
||||||
Write data to the file. If write buffering is on (C{bufsize} was
|
Write data to the file. If write buffering is on (C{bufsize} was
|
||||||
specified and non-zero, some or all of the data may not actually be
|
specified and non-zero), some or all of the data may not actually be
|
||||||
written yet. (Use L{flush} or L{close} to force buffered data to be
|
written yet. (Use L{flush} or L{close} to force buffered data to be
|
||||||
written out.)
|
written out.)
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ class Message (object):
|
||||||
as comma-separated values in a string.
|
as comma-separated values in a string.
|
||||||
|
|
||||||
@return: a list of strings.
|
@return: a list of strings.
|
||||||
@type: list of strings
|
@rtype: list of strings
|
||||||
"""
|
"""
|
||||||
str = self.get_string()
|
str = self.get_string()
|
||||||
l = string.split(str, ',')
|
l = string.split(str, ',')
|
||||||
|
|
Loading…
Reference in New Issue