mirror of
https://github.com/google/brotli.git
synced 2024-11-25 13:00:06 +00:00
Python: Publicly expose the Compressor object in the Python API (#456)
Progress on #191
This commit is contained in:
parent
5632315d35
commit
afb1272792
@ -16,6 +16,9 @@ MODE_GENERIC = _brotli.MODE_GENERIC
|
|||||||
MODE_TEXT = _brotli.MODE_TEXT
|
MODE_TEXT = _brotli.MODE_TEXT
|
||||||
MODE_FONT = _brotli.MODE_FONT
|
MODE_FONT = _brotli.MODE_FONT
|
||||||
|
|
||||||
|
# The Compressor object.
|
||||||
|
Compressor = _brotli.Compressor
|
||||||
|
|
||||||
# Compress a byte string.
|
# Compress a byte string.
|
||||||
def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0,
|
def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0,
|
||||||
dictionary=''):
|
dictionary=''):
|
||||||
@ -42,7 +45,7 @@ def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0,
|
|||||||
Raises:
|
Raises:
|
||||||
brotli.error: If arguments are invalid, or compressor fails.
|
brotli.error: If arguments are invalid, or compressor fails.
|
||||||
"""
|
"""
|
||||||
compressor = _brotli.Compressor(mode=mode, quality=quality, lgwin=lgwin,
|
compressor = Compressor(mode=mode, quality=quality, lgwin=lgwin,
|
||||||
lgblock=lgblock, dictionary=dictionary)
|
lgblock=lgblock, dictionary=dictionary)
|
||||||
return compressor.process(string) + compressor.finish()
|
return compressor.process(string) + compressor.finish()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user