I have this function that simply writes a string into a stream buffer:
import sysfrom typing import IOdef write(s: str, stream: IO[bytes] = sys.stdout.buffer): stream.write(s.encode()) stream.flush()
I'm using both flake8 and mypy which don't complaint while pdoc throws an attribute error:
[...] def write(s: str, stream: IO[bytes] = sys.stdout.buffer):AttributeError: '_io.StringIO' object has no attribute 'buffer'
Is there a way to fix this?