MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / read

Method read

tools/python-3.11.9-amd64/Lib/chunk.py:126–147  ·  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

124 return self.size_read
125
126 def read(self, size=-1):
127 """Read at most size bytes from the chunk.
128 If size is omitted or negative, read until the end
129 of the chunk.
130 """
131
132 if self.closed:
133 raise ValueError("I/O operation on closed file")
134 if self.size_read >= self.chunksize:
135 return b''
136 if size < 0:
137 size = self.chunksize - self.size_read
138 if size > self.chunksize - self.size_read:
139 size = self.chunksize - self.size_read
140 data = self.file.read(size)
141 self.size_read = self.size_read + len(data)
142 if self.size_read == self.chunksize and \
143 self.align and \
144 (self.chunksize & 1):
145 dummy = self.file.read(1)
146 self.size_read = self.size_read + len(dummy)
147 return data
148
149 def skip(self):
150 """Skip the rest of the chunk.

Callers 3

initfpMethod · 0.95
skipMethod · 0.95
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected