MCPcopy
hub / github.com/benoitc/gunicorn / decode_full

Method decode_full

gunicorn/dirty/tlv.py:284–303  ·  view source on GitHub ↗

Decode a complete TLV-encoded value, ensuring all data is consumed. Args: data: Binary data to decode Returns: Decoded Python value Raises: DirtyProtocolError: If data is malformed or has trailing bytes

(data: bytes)

Source from the content-addressed store, hash-verified

282
283 @staticmethod
284 def decode_full(data: bytes):
285 """
286 Decode a complete TLV-encoded value, ensuring all data is consumed.
287
288 Args:
289 data: Binary data to decode
290
291 Returns:
292 Decoded Python value
293
294 Raises:
295 DirtyProtocolError: If data is malformed or has trailing bytes
296 """
297 value, offset = TLVEncoder.decode(data, 0)
298 if offset != len(data):
299 raise DirtyProtocolError(
300 f"Trailing data after TLV: {len(data) - offset} bytes",
301 raw_data=data[offset:offset + 20]
302 )
303 return value

Callers 5

decode_messageMethod · 0.80
read_message_asyncMethod · 0.80
read_messageMethod · 0.80

Calls 2

DirtyProtocolErrorClass · 0.85
decodeMethod · 0.80

Tested by 2