Write the output stream.
(
stream: BaseStream,
outfile: Union[IO, TextIO],
flush: bool
)
| 59 | |
| 60 | |
| 61 | def write_stream( |
| 62 | stream: BaseStream, |
| 63 | outfile: Union[IO, TextIO], |
| 64 | flush: bool |
| 65 | ): |
| 66 | """Write the output stream.""" |
| 67 | try: |
| 68 | # Writing bytes so we use the buffer interface. |
| 69 | buf = outfile.buffer |
| 70 | except AttributeError: |
| 71 | buf = outfile |
| 72 | |
| 73 | for chunk in stream: |
| 74 | buf.write(chunk) |
| 75 | if flush: |
| 76 | outfile.flush() |
| 77 | |
| 78 | |
| 79 | def write_stream_with_colors_win( |
no test coverage detected