This is similar to a bug in the Pycharm module or typing. From the module typing.py:
class BinaryIO(IO[bytes]):
"""Typed version of the return of open() in binary mode."""
...
The documentation also indicates:
-, open().
, . FileIO.
from io import FileIO
def do_something(filename: str):
my_file = open(filename, "rb")
read_data(my_file)
def read_data(some_binary_readable_thing: FileIO[bytes]):
pass