I am trying to create a BufferedReader from a BytesIO object but my IDE (PyCharm) is warning me that BufferedReader Expected type 'RawIOBase', got 'BytesIO' instead.
The logic seems to work but I'd like to solve this properly if there is a way to do so.
Another way to phrase this question would be: can BufferedReader wrap a BytesIO object or can it only do so with objects that extend the RawIOBase interface?
Minimum reproducible code below:
from io import BytesIO, BufferedReader
b_handle = BytesIO()
b_handle.write(b"Hello World")
b_handle.seek(0)
# Warning: Expected type 'RawIOBase', got 'BytesIO' instead
br = BufferedReader(b_handle)
data = br.read()
print(data)