Skip to content

Commit b40b487

Browse files
committed
fix(python): add missing stub for max_output_length of Dcompressor.process
1 parent 8d65f86 commit b40b487

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

python/brotli/__init__.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Functions to compress and decompress data using the Brotli library.
88
"""
99

10-
from typing import Union
10+
from typing import Optional, Union
1111

1212
ByteString = Union[bytes, bytearray, memoryview]
1313

@@ -114,16 +114,23 @@ class Decompressor:
114114
"""
115115
...
116116

117-
def process(self, string: ByteString) -> bytes:
117+
def process(self, string: ByteString, max_output_length: Optional[int] = None) -> bytes:
118118
"""Process "string" for decompression, returning a string that contains
119119
decompressed output data. This data should be concatenated to the output
120120
produced by any preceding calls to the "process()" method.
121121
Some or all of the input may be kept in internal buffers for later
122122
processing, and the decompressed output data may be empty until enough input
123123
has been accumulated.
124+
If max_output_length is set, no more than max_output_length bytes will be
125+
returned. If the limit is reached, further calls to process (potentially with
126+
empty input) will continue to yield more data. If, after returning a string of
127+
the length equal to limit, can_accept_more_data() returns False, process()
128+
must only be called with empty input until can_accept_more_data() once again
129+
returns True.
124130
125131
Args:
126132
string (bytes): The input data
133+
max_output_length (int, optional): The maximum length of the output data.
127134
128135
Returns:
129136
The decompressed output data (bytes)

0 commit comments

Comments
 (0)