MCPcopy Index your code
hub / github.com/Textualize/textual / get_bytes

Function get_bytes

src/textual/_binary_encode.py:210–227  ·  view source on GitHub ↗

Get a number of bytes of encode data. Args: size: Number of bytes to retrieve. Raises: DecodeError: If there aren't enough bytes. Returns: A bytes object.

(size: int)

Source from the content-addressed store, hash-verified

208 return encoded[position : position + 1]
209
210 def get_bytes(size: int) -> bytes:
211 """Get a number of bytes of encode data.
212
213 Args:
214 size: Number of bytes to retrieve.
215
216 Raises:
217 DecodeError: If there aren't enough bytes.
218
219 Returns:
220 A bytes object.
221 """
222 nonlocal position
223 bytes_data = encoded[position : position + size]
224 if len(bytes_data) != size:
225 raise DecodeError(b"Missing bytes in {bytes_data!r}")
226 position += size
227 return bytes_data
228
229 def decode_int() -> int:
230 """Decode an int from the encoded data.

Callers 2

decode_bytesFunction · 0.85
decode_stringFunction · 0.85

Calls 1

DecodeErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…