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

Method push

inspiremusic/utils/binary.py:70–79  ·  view source on GitHub ↗

Push a new value to the stream. This will immediately write as many uint8 as possible to the underlying file-object.

(self, value: int)

Source from the content-addressed store, hash-verified

68 self.fo = fo
69
70 def push(self, value: int):
71 """Push a new value to the stream. This will immediately
72 write as many uint8 as possible to the underlying file-object."""
73 self._current_value += (value << self._current_bits)
74 self._current_bits += self.bits
75 while self._current_bits >= 8:
76 lower_8bits = self._current_value & 0xff
77 self._current_bits -= 8
78 self._current_value >>= 8
79 self.fo.write(bytes([lower_8bits]))
80
81 def flush(self):
82 """Flushes the remaining partial uint8, call this at the end

Callers 1

testFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected