MCPcopy Create free account
hub / github.com/libgit2/pygit2 / readinto

Method readinto

pygit2/blob.py:60–85  ·  view source on GitHub ↗
(self, b, /)

Source from the content-addressed store, hash-verified

58 return False
59
60 def readinto(self, b, /):
61 try:
62 while self._chunk is None:
63 self._ready.wait()
64 if self._queue.empty():
65 if self._writer_closed.is_set():
66 # EOF
67 return 0
68 self._ready.clear()
69 time.sleep(0)
70 continue
71 chunk = self._queue.get()
72 if chunk:
73 self._chunk = chunk
74
75 if len(self._chunk) <= len(b):
76 bytes_written = len(self._chunk)
77 b[:bytes_written] = self._chunk
78 self._chunk = None
79 return bytes_written
80 bytes_written = len(b)
81 b[:] = self._chunk[:bytes_written]
82 self._chunk = self._chunk[bytes_written:]
83 return bytes_written
84 except KeyboardInterrupt:
85 return 0
86
87 def close(self) -> None:
88 try:

Callers

nothing calls this directly

Calls 2

clearMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected