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

Function _read_exactly

inspiremusic/utils/binary.py:31–40  ·  view source on GitHub ↗
(fo: tp.IO[bytes], size: int)

Source from the content-addressed store, hash-verified

29
30
31def _read_exactly(fo: tp.IO[bytes], size: int) -> bytes:
32 buf = b""
33 while len(buf) < size:
34 new_buf = fo.read(size)
35 if not new_buf:
36 raise EOFError("Impossible to read enough data from the stream, "
37 f"{size} bytes remaining.")
38 buf += new_buf
39 size -= len(new_buf)
40 return buf
41
42
43def read_ecdc_header(fo: tp.IO[bytes]):

Callers 1

read_ecdc_headerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected