[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-138]
doc fixups little doc fixups that i did obsessively on the train one morning.
This commit is contained in:
parent
1eda9b051b
commit
b89025d409
|
@ -35,7 +35,7 @@ _FLAG_UNIVERSAL_NEWLINE = 0x80
|
||||||
class BufferedFile (object):
|
class BufferedFile (object):
|
||||||
"""
|
"""
|
||||||
Reusable base class to implement python-style file buffering around a
|
Reusable base class to implement python-style file buffering around a
|
||||||
simpler stream
|
simpler stream.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_DEFAULT_BUFSIZE = 8192
|
_DEFAULT_BUFSIZE = 8192
|
||||||
|
@ -124,7 +124,7 @@ class BufferedFile (object):
|
||||||
result = self._rbuffer
|
result = self._rbuffer
|
||||||
self._rbuffer = ''
|
self._rbuffer = ''
|
||||||
self._pos += len(result)
|
self._pos += len(result)
|
||||||
while 1:
|
while True:
|
||||||
try:
|
try:
|
||||||
new_data = self._read(self._DEFAULT_BUFSIZE)
|
new_data = self._read(self._DEFAULT_BUFSIZE)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
|
@ -175,8 +175,10 @@ class BufferedFile (object):
|
||||||
# it's almost silly how complex this function is.
|
# it's almost silly how complex this function is.
|
||||||
if self._closed:
|
if self._closed:
|
||||||
raise IOError('File is closed')
|
raise IOError('File is closed')
|
||||||
|
if not (self._flags & _FLAG_READ):
|
||||||
|
raise IOError('File not open for reading')
|
||||||
line = self._rbuffer
|
line = self._rbuffer
|
||||||
while 1:
|
while True:
|
||||||
if self._at_trailing_cr and (self._flags & _FLAG_UNIVERSAL_NEWLINE) and (len(line) > 0):
|
if self._at_trailing_cr and (self._flags & _FLAG_UNIVERSAL_NEWLINE) and (len(line) > 0):
|
||||||
# edge case: the newline may be '\r\n' and we may have read
|
# edge case: the newline may be '\r\n' and we may have read
|
||||||
# only the first '\r' last time.
|
# only the first '\r' last time.
|
||||||
|
@ -261,8 +263,8 @@ class BufferedFile (object):
|
||||||
objects support seeking.
|
objects support seeking.
|
||||||
|
|
||||||
@note: If a file is opened in append mode (C{'a'} or C{'a+'}), any seek
|
@note: If a file is opened in append mode (C{'a'} or C{'a+'}), any seek
|
||||||
operations will be undone at the next write (as the file position will
|
operations will be undone at the next write (as the file position
|
||||||
move back to the end of the file).
|
will move back to the end of the file).
|
||||||
|
|
||||||
@param offset: position to move to within the file, relative to
|
@param offset: position to move to within the file, relative to
|
||||||
C{whence}.
|
C{whence}.
|
||||||
|
|
Loading…
Reference in New Issue