Lines Matching defs:read
185 a file in a binary mode, the returned class varies: in read binary
187 modes, it returns a BufferedWriter, and in read/write mode, it returns
220 raise ValueError("can't have read/write/append mode at once")
222 raise ValueError("must have exactly one of read/write/append mode")
337 represent a file that cannot be read, written or seeked.
339 Even though IOBase does not declare read or write because
345 The basic type used for binary data read from or written to a file is
405 This is not implemented for read-only and non-blocking streams.
468 If False, read() will raise OSError.
543 If size is specified, at most size bytes will be read.
574 b = self.read(nreadahead())
595 hint can be specified to control the number of lines read: no more
596 lines will be read if the total size (in bytes/characters) of all
627 # The read() method is implemented by calling readinto(); derived
628 # classes that want to support read() only need to implement
630 # more efficient than read().
633 # readinto() in terms of read(), in case the latter is a more suitable
637 def read(self, size=-1):
641 set not to block and has no data to read.
655 """Read until EOF, using multiple read() call."""
658 data = self.read(DEFAULT_BUFFER_SIZE)
671 Returns an int representing the number of bytes read (0 for EOF), or
672 None if the object is set not to block and has no data to read.
693 The main difference with RawIOBase is that the read() method
697 In addition, read(), readinto() and write() may raise
706 def read(self, size=-1):
716 read will be issued, and a short result does not imply that
724 self._unsupported("read")
727 """Read up to size bytes with at most one read() system call,
735 Like read(), this may issue multiple reads to the underlying raw
738 Returns an int representing the number of bytes read (0 for EOF).
749 Returns an int representing the number of bytes read (0 for EOF).
765 data = self.read(len(b))
800 does *not* provide implementations of read(), readinto() or
941 def read(self, size=-1):
943 raise ValueError("read from closed file")
963 """This is the same as read.
965 return self.read(size)
1076 def read(self, size=None):
1081 mode. If size is negative, read until EOF or until read() would
1085 raise ValueError("invalid number of bytes to read")
1095 # Special case for when the number of bytes to read is unspecified.
1107 # Read until EOF or until read() would block.
1108 chunk = self.raw.read()
1116 # The number of bytes to read is specified, return at most n bytes.
1119 # Fast path: the data to read is fully buffered.
1122 # Slow path: read from the stream until enough bytes are read,
1123 # or until an EOF occurs or until read() would block.
1127 chunk = self.raw.read(wanted)
1134 # read() would have blocked.
1145 do at most one raw read to satisfy it. We never return more
1156 current = self.raw.read(to_read)
1163 """Reads up to size bytes, with at most one read() system call."""
1165 # only return buffered bytes. Otherwise, we do one raw read.
1177 # read() and read1()). We do it anyway to keep the _pyio implementation
1196 # First try to read from internal buffer
1207 # internal buffer, read directly into callers buffer
1349 form a sequential IO object that can read and write. This is typically
1374 def read(self, size=-1):
1377 return self.reader.read(size)
1436 # Undo read ahead.
1439 # First do the raw seek, then empty the read buffer, so that
1457 # Use seek to flush the read buffer.
1460 def read(self, size=None):
1464 return BufferedReader.read(self, size)
1535 raise ValueError('Must have exactly one of create/read/write/append '
1653 def read(self, size=None):
1665 return os.read(self._fd, size)
1693 chunk = os.read(self._fd, n)
1707 data = self.read(len(m))
1788 """True if file was opened in a read mode."""
1842 def read(self, size=-1):
1846 If size is negative or omitted, read until EOF.
1850 self._unsupported("read")
1931 # Record which newlines are read
2002 legal values, that newline becomes the newline when the file is read
2045 self._decoded_chars_used = 0 # offset into _decoded_chars for read()
2143 "after the first read")
2248 # requests it by calling our read() or readline() method.
2305 input_chunk = self.buffer.read(self._CHUNK_SIZE)
2315 # At the snapshot point, len(dec_buffer) bytes before the read,
2324 # decoder flags to dec_flags, read bytes_to_feed bytes, feed them
2494 # and replay the effect of read(chars_to_skip) from there.
2513 input_chunk = self.buffer.read(bytes_to_feed)
2526 def read(self, size=None):
2541 decoder.decode(self.buffer.read(), final=True))
2565 raise ValueError("read from closed file")