MCPcopy Index your code
hub / github.com/RustPython/RustPython / read

Method read

Lib/wave.py:167–188  ·  view source on GitHub ↗

Read at most size bytes from the chunk. If size is omitted or negative, read until the end of the chunk.

(self, size=-1)

Source from the content-addressed store, hash-verified

165 return self.size_read
166
167 def read(self, size=-1):
168 """Read at most size bytes from the chunk.
169 If size is omitted or negative, read until the end
170 of the chunk.
171 """
172
173 if self.closed:
174 raise ValueError("I/O operation on closed file")
175 if self.size_read >= self.chunksize:
176 return b''
177 if size < 0:
178 size = self.chunksize - self.size_read
179 if size > self.chunksize - self.size_read:
180 size = self.chunksize - self.size_read
181 data = self.file.read(size)
182 self.size_read = self.size_read + len(data)
183 if self.size_read == self.chunksize and \
184 self.align and \
185 (self.chunksize & 1):
186 dummy = self.file.read(1)
187 self.size_read = self.size_read + len(dummy)
188 return data
189
190 def skip(self):
191 """Skip the rest of the chunk.

Callers 5

skipMethod · 0.95
__init__Method · 0.45
initfpMethod · 0.45
readframesMethod · 0.45
_read_fmt_chunkMethod · 0.45

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected