Example #1
0
 def readinto(self, b: bytearray) -> Optional[int]:
     raise io.UnsupportedOperation()
Example #2
0
 def detach(self):
     raise io.UnsupportedOperation("detach() not supported")
Example #3
0
 def _check_can_read(self):
     if not self.readable():
         raise io.UnsupportedOperation("File not open for reading")
Example #4
0
 def readline(self, size=-1):
     """Read a line."""
     raise io.UnsupportedOperation("cannot read a line from a Jupyter redirect")
Example #5
0
 def truncate(self, size=None):
     """Truncate both buffers."""
     raise io.UnsupportedOperation("cannot truncate Jupyter redirect")
Example #6
0
 def seek(self, offset, whence=io.SEEK_SET):
     """Seek to a location."""
     raise io.UnsupportedOperation("cannot seek Jupyter redirect")
Example #7
0
 def detach(self):
     """This operation is not supported."""
     raise io.UnsupportedOperation("cannot detach a Jupyter redirect")
Example #8
0
 def _check_can_write(self):
     if self._mode != _MODE_WRITE:
         self._check_not_closed()
         raise io.UnsupportedOperation("File not open for writing")
 def readinto(self, buf):
     raise io.UnsupportedOperation('readinto')
Example #10
0
 def read(self, n=-1):
     raise io.UnsupportedOperation("read")
Example #11
0
 def _check_can_read(self):
     if self._mode not in (_MODE_READ, _MODE_READ_EOF):
         self._check_not_closed()
         raise io.UnsupportedOperation("File not open for reading")
Example #12
0
 def write(self, b):
     # This is needed because python will not always return the correct
     # kind of error even though writeable returns False.
     raise io.UnsupportedOperation("write")
Example #13
0
 def write(self, b: bytes) -> int:
     raise io.UnsupportedOperation()
Example #14
0
 def __next__(self):
     """Iterator API."""
     raise io.UnsupportedOperation('Cannot iterate an EncryptingStream')
Example #15
0
 def read(self, size=-1):
     raise io.UnsupportedOperation('read')
Example #16
0
 def seek(self, pos: int, whence: int = 0) -> int:
     if self._seekable:
         return self._bytes_io.seek(pos, whence)
     raise io.UnsupportedOperation('seek')
Example #17
0
 def write(self, value):
     raise io.UnsupportedOperation('write')
Example #18
0
 def seek(self, pos: int, whence: int = 0) -> int:
     if self._seekable:
         return super(SlowBytesIO, self).seek(pos, whence)
     raise io.UnsupportedOperation('seek')
Example #19
0
 def truncate(self, size=None):
     """Truncate the streams."""
     raise io.UnsupportedOperation("cannot truncate Jupyter redirect")
Example #20
0
 def write(self, _):
     """See io.RawIOBase.write."""
     raise io.UnsupportedOperation('write')
Example #21
0
 def read(self, size=None):
     """Read from the stream"""
     raise io.UnsupportedOperation("cannot read a Jupyter redirect")
Example #22
0
 def readinto1(self, *args, **kwargs):
     if 'r' not in self.mode and '+' not in self.mode:
         raise io.UnsupportedOperation('not readable')
     return self.stream.readinto1(*args, **kwargs)
Example #23
0
 def seek(self, offset, whence=io.SEEK_SET):
     """Sets the location in both the stdbuf and the membuf."""
     raise io.UnsupportedOperation("cannot seek Jupyter redirect")
Example #24
0
 def read(self, size=-1):
     if 'r' not in self.mode and '+' not in self.mode:
         raise io.UnsupportedOperation('not readable')
     return self.stream.read(size)
Example #25
0
 def readinto(self, b):
     """Read bytes into buffer from both streams."""
     raise io.UnsupportedOperation("cannot read into Jupyter redirect")
Example #26
0
 def readlines(self, hint=-1):
     if 'r' not in self.mode and '+' not in self.mode:
         raise io.UnsupportedOperation('not readable')
     return self.stream.readlines(hint)
Example #27
0
 def fileno_opt(self):
     raise io.UnsupportedOperation('Not a real file')
Example #28
0
 def write(self, s):
     if 'r' in self.mode and '+' not in self.mode:
         raise io.UnsupportedOperation('not writable')
     return self.stream.write(s)
Example #29
0
 def _check_can_write(self):
     if not self.writable():
         raise io.UnsupportedOperation("File not open for writing")
Example #30
0
 def fileno(self) -> int:
     raise io.UnsupportedOperation(
         "redirected stdin is pseudofile, has no fileno()")