File-like object representing an input blob.
ConstructorInputStream()
Methods close
Flush and close the IO object.
This method has no effect if the file is already closed.
detachDisconnect this buffer from its underlying raw stream and return it.
After the raw stream has been detached, the buffer is in an unusable state.
filenoReturns underlying file descriptor if one exists.
OSError is raised if the IO object does not use a file descriptor.
flushFlush write buffers, if applicable.
This is not implemented for read-only and non-blocking streams.
isattyReturn whether this is an 'interactive' stream.
Return False if it can't be determined.
readReturn and read up to size bytes.
read1Read and return up to n bytes, with at most one read() call to the underlying raw stream. A short result does not imply that EOF is imminent.
Returns an empty bytes object on EOF.
readableReturn whether object was opened for reading.
If False, read() will raise OSError.
readinto readinto1 readlineRead and return a line from the stream.
If size is specified, at most size bytes will be read.
The line terminator is always b'n' for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized.
readlinesReturn a list of lines from the stream.
hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.
seekChange the stream position to the given byte offset.
offset The stream position, relative to 'whence'.
whence The relative position to seek from.
The offset is interpreted relative to the position indicated by whence. Values for whence are:
os.SEEK_SET or 0 â start of stream (the default); offset should be zero or positive
os.SEEK_CUR or 1 â current stream position; offset may be negative
os.SEEK_END or 2 â end of stream; offset is usually negative
Return the new absolute position.
seekableReturn whether object supports random access.
If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().
tellReturn current stream position.
truncateTruncate file to size bytes.
File pointer is left unchanged. Size defaults to the current IO position as reported by tell(). Returns the new size.
writableReturn whether object was opened for writing.
If False, write() will raise OSError.
writeWrite the given buffer to the IO stream.
Returns the number of bytes written, which is always the length of b in bytes.
Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment.
writelinesWrite a list of lines to stream.
Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.
closeFlush and close the IO object.
This method has no effect if the file is already closed.
close()
detach
Disconnect this buffer from its underlying raw stream and return it.
After the raw stream has been detached, the buffer is in an unusable state.
detach()
fileno
Returns underlying file descriptor if one exists.
OSError is raised if the IO object does not use a file descriptor.
fileno()
flush
Flush write buffers, if applicable.
This is not implemented for read-only and non-blocking streams.
flush()
isatty
Return whether this is an 'interactive' stream.
Return False if it can't be determined.
isatty()
read
Return and read up to size bytes.
abstract read(size=-1) -> bytes
Parameters Returns read1
Read and return up to n bytes, with at most one read() call to the underlying raw stream. A short result does not imply that EOF is imminent.
Returns an empty bytes object on EOF.
read1()
readable
Return whether object was opened for reading.
If False, read() will raise OSError.
readable()
readinto
readinto(buffer, /)
Positional-Only Parameters readinto1
readinto1(buffer, /)
Positional-Only Parameters readline
Read and return a line from the stream.
If size is specified, at most size bytes will be read.
The line terminator is always b'n' for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized.
readline(size=-1, /)
Positional-Only Parameters readlines
Return a list of lines from the stream.
hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.
readlines(hint=-1, /)
Positional-Only Parameters seek
Change the stream position to the given byte offset.
offset The stream position, relative to 'whence'.
whence The relative position to seek from.
The offset is interpreted relative to the position indicated by whence. Values for whence are:
os.SEEK_SET or 0 â start of stream (the default); offset should be zero or positive
os.SEEK_CUR or 1 â current stream position; offset may be negative
os.SEEK_END or 2 â end of stream; offset is usually negative
Return the new absolute position.
seek(offset, whence=0, /)
Positional-Only Parameters seekable
Return whether object supports random access.
If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().
seekable()
tell
Return current stream position.
tell()
truncate
Truncate file to size bytes.
File pointer is left unchanged. Size defaults to the current IO position as reported by tell(). Returns the new size.
truncate()
writable
Return whether object was opened for writing.
If False, write() will raise OSError.
writable()
write
Write the given buffer to the IO stream.
Returns the number of bytes written, which is always the length of b in bytes.
Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment.
write()
writelines
Write a list of lines to stream.
Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.
writelines(lines, /)
Positional-Only Parameters Attributes
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4