MCPcopy
hub / github.com/quodlibet/mutagen / bytes

Method bytes

mutagen/_util.py:996–1009  ·  view source on GitHub ↗

Returns a bytearray of length `count`. Works unaligned.

(self, count: int)

Source from the content-addressed store, hash-verified

994 return value
995
996 def bytes(self, count: int) -> bytes:
997 """Returns a bytearray of length `count`. Works unaligned."""
998
999 if count < 0:
1000 raise ValueError
1001
1002 # fast path
1003 if self._bits == 0:
1004 data = self._fileobj.read(count)
1005 if len(data) != count:
1006 raise BitReaderError("not enough data")
1007 return data
1008
1009 return bytes(bytearray(self.bits(8) for _ in range(count)))
1010
1011 def skip(self, count: int) -> None:
1012 """Skip `count` bits.

Callers 6

test_bytesMethod · 0.95
test_bytes_unalignedMethod · 0.95
__init__Method · 0.95
__init__Method · 0.95
__init__Method · 0.80
syncMethod · 0.80

Calls 3

bitsMethod · 0.95
BitReaderErrorClass · 0.85
readMethod · 0.45

Tested by 2

test_bytesMethod · 0.76
test_bytes_unalignedMethod · 0.76