(stream: t.IO[t.Any], default: bool = False)
| 149 | |
| 150 | |
| 151 | def _is_binary_reader(stream: t.IO[t.Any], default: bool = False) -> bool: |
| 152 | try: |
| 153 | return isinstance(stream.read(0), bytes) |
| 154 | except Exception: |
| 155 | return default |
| 156 | # This happens in some cases where the stream was already |
| 157 | # closed. In this case, we assume the default. |
| 158 | |
| 159 | |
| 160 | def _is_binary_writer(stream: t.IO[t.Any], default: bool = False) -> bool: |
no test coverage detected