def __init__(self, stream): # duck-type instead of checking inheritance from IOBase. # At the least, stream must have read() if not callable(getattr(stream, 'read', None)): raise TypeError('I/O stream type expected') assert not isinstance(stream, InputStream) super().__init__() self._stream = stream self._binding = _awscrt.input_stream_new(self)
def __init__(self, stream): assert isinstance(stream, io.IOBase) assert not isinstance(stream, InputStream) super(InputStream, self).__init__() self._binding = _awscrt.input_stream_new(stream)