def __init__(self, *args, **kwargs): _ObjectRawIOBase.__init__(self, *args, **kwargs) # Only support readonly if 'r' not in self._mode: raise _UnsupportedOperation('write') # Check if object support random read self._seekable = self._head().get('Accept-Ranges') == 'bytes'
def _getsize_from_header(self, header): """ Return the size from header Args: header (dict): Object header. Returns: int: Size in bytes. """ try: return header.pop('ContentLength') except KeyError: raise _UnsupportedOperation('getsize')
def _get_time(header, keys, name): """ Get time from header Args: header (dict): Object header. keys (tuple of str): Header keys. name (str): Method name. Returns: float: The number of seconds since the epoch """ for key in keys: try: return header.pop(key).timestamp() except KeyError: continue raise _UnsupportedOperation(name)
def fileno(self): raise _UnsupportedOperation()
def fileno(self): raise _UnsupportedOperation()
def __init__(self, *args, **kwargs): _ObjectRawIOBase.__init__(self, *args, **kwargs) if "r" not in self._mode: raise _UnsupportedOperation("write") self._seekable = self._head().get("Accept-Ranges") == "bytes"