OpenQuizz
Une application de gestion des contenus pédagogiques
LazyZipOverHTTP Class Reference

Public Member Functions

def __init__ (self, url, session, chunk_size=CONTENT_CHUNK_SIZE)
 
def mode (self)
 
def name (self)
 
def seekable (self)
 
def close (self)
 
def closed (self)
 
def read (self, size=-1)
 
def readable (self)
 
def seek (self, offset, whence=0)
 
def tell (self)
 
def truncate (self, size=None)
 
def writable (self)
 
def __enter__ (self)
 
def __exit__ (self, *exc)
 

Detailed Description

File-like object mapped to a ZIP file over HTTP.

This uses HTTP range requests to lazily fetch the file's content,
which is supposed to be fed to ZipFile.  If such requests are not
supported by the server, raise HTTPRangeRequestUnsupported
during initialization.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  url,
  session,
  chunk_size = CONTENT_CHUNK_SIZE 
)

Member Function Documentation

◆ __enter__()

def __enter__ (   self)

◆ __exit__()

def __exit__ (   self,
exc 
)

◆ close()

def close (   self)
Close the file.

◆ closed()

def closed (   self)
Whether the file is closed.

◆ mode()

def mode (   self)
Opening mode, which is always rb.

◆ name()

def name (   self)
Path to the underlying file.

◆ read()

def read (   self,
  size = -1 
)
Read up to size bytes from the object and return them.

As a convenience, if size is unspecified or -1,
all bytes until EOF are returned.  Fewer than
size bytes may be returned if EOF is reached.

◆ readable()

def readable (   self)
Return whether the file is readable, which is True.

◆ seek()

def seek (   self,
  offset,
  whence = 0 
)
Change stream position and return the new absolute position.

Seek to offset relative position indicated by whence:
* 0: Start of stream (the default).  pos should be >= 0;
* 1: Current position - pos may be negative;
* 2: End of stream - pos usually negative.

◆ seekable()

def seekable (   self)
Return whether random access is supported, which is True.

◆ tell()

def tell (   self)
Return the current possition.

◆ truncate()

def truncate (   self,
  size = None 
)
Resize the stream to the given size in bytes.

If size is unspecified resize to the current position.
The current stream position isn't changed.

Return the new file size.

◆ writable()

def writable (   self)
Return False.

The documentation for this class was generated from the following file: