(self, key, data)
| 293 | return isinstance(obj_to_check, (io.BufferedIOBase, io.RawIOBase)) |
| 294 | |
| 295 | def decode1(self, key, data): |
| 296 | if not data: |
| 297 | return data |
| 298 | |
| 299 | # if data is a stream handle, we need to read all the content before decoding |
| 300 | if Decoder._is_stream_handle(data): |
| 301 | ds = data |
| 302 | # The behavior of .read can differ between streams (e.g. HTTPResponse), hence this is used instead |
| 303 | data = b"".join(data) |
| 304 | ds.close() |
| 305 | |
| 306 | for f in self.handlers: |
| 307 | result = f(key, data) |
| 308 | if result is not None: |
| 309 | return result |
| 310 | return data |
| 311 | |
| 312 | def decode(self, data): |
| 313 | result = {} |
no test coverage detected