MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / __init__

Method __init__

aiohttp/compression_utils.py:194–219  ·  view source on GitHub ↗
(
        self,
        encoding: str | None = None,
        suppress_deflate_header: bool = False,
        level: int | None = None,
        wbits: int | None = None,
        strategy: int | None = None,
        executor: Executor | None = None,
        max_sync_chunk_size: int | None = MAX_SYNC_CHUNK_SIZE,
    )

Source from the content-addressed store, hash-verified

192
193class ZLibCompressor:
194 def __init__(
195 self,
196 encoding: str | None = None,
197 suppress_deflate_header: bool = False,
198 level: int | None = None,
199 wbits: int | None = None,
200 strategy: int | None = None,
201 executor: Executor | None = None,
202 max_sync_chunk_size: int | None = MAX_SYNC_CHUNK_SIZE,
203 ):
204 self._executor = executor
205 self._max_sync_chunk_size = max_sync_chunk_size
206 self._mode = (
207 encoding_to_mode(encoding, suppress_deflate_header)
208 if wbits is None
209 else wbits
210 )
211 self._zlib_backend: Final = ZLibBackendWrapper(ZLibBackend._zlib_backend)
212
213 kwargs: CompressObjArgs = {}
214 kwargs["wbits"] = self._mode
215 if strategy is not None:
216 kwargs["strategy"] = strategy
217 if level is not None:
218 kwargs["level"] = level
219 self._compressor = self._zlib_backend.compressobj(**kwargs)
220
221 def compress_sync(self, data: Buffer) -> bytes:
222 return self._compressor.compress(data)

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 3

encoding_to_modeFunction · 0.85
ZLibBackendWrapperClass · 0.85
compressobjMethod · 0.45

Tested by

no test coverage detected