Skip to content

symfonic.capabilities.memory.rendering

rendering

Render declared classification as data, never as a trusted instruction.

compress_bounded

compress_bounded(block, compressor, ceiling, *, count_bytes)

Keep the admitted original if a custom compressor expands past its cap.

Source code in src/symfonic/capabilities/memory/rendering.py
def compress_bounded(block, compressor, ceiling, *, count_bytes):
    """Keep the admitted original if a custom compressor expands past its cap."""
    compressed = compressor(block)
    size = len(compressed.encode("utf-8") if count_bytes else compressed)
    return (block, True) if size > ceiling else (compressed, False)