MCPcopy Create free account
hub / github.com/FunAudioLLM/FunMusic / pull

Method pull

inspiremusic/utils/binary.py:106–123  ·  view source on GitHub ↗

Pull a single value from the stream, potentially reading some extra bytes from the underlying file-object. Returns `None` when reaching the end of the stream.

(self)

Source from the content-addressed store, hash-verified

104 self._current_bits = 0
105
106 def pull(self) -> tp.Optional[int]:
107 """
108 Pull a single value from the stream, potentially reading some
109 extra bytes from the underlying file-object.
110 Returns `None` when reaching the end of the stream.
111 """
112 while self._current_bits < self.bits:
113 buf = self.fo.read(1)
114 if not buf:
115 return None
116 character = buf[0]
117 self._current_value += character << self._current_bits
118 self._current_bits += 8
119
120 out = self._current_value & self._mask
121 self._current_value >>= self.bits
122 self._current_bits -= self.bits
123 return out
124
125
126def test():

Callers 1

testFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected