l.u.files : module documentation

Part of libcloud.utils View Source

No module docstring
Function read_in_chunks Return a generator which yields data in chunks.
Function exhaust_iterator Exhaust an iterator and return all data returned by it.
Function guess_file_mime_type Undocumented
def read_in_chunks(iterator, chunk_size=None, fill_size=False): (source)
Return a generator which yields data in chunks.

@type iterator: C{Iterator}
@param response: An object which implements an iterator interface
                 or a File like object with read method.

@type chunk_size: C{int}
@param chunk_size: Optional chunk size (defaults to CHUNK_SIZE)

@type fill_size: C{bool}
@param fill_size: If True, make sure chunks are chunk_size in length
                  (except for last chunk).

TODO: At some point in the future we could use byte arrays here if version
>= Python 3. This should speed things up a bit and reduce memory usage.
def exhaust_iterator(iterator): (source)
Exhaust an iterator and return all data returned by it.

@type iterator: C{Iterator}
@param response: An object which implements an iterator interface
                 or a File like object with read method.

@rtype C{str}
@return Data returned by the iterator.
def guess_file_mime_type(file_path): (source)
Undocumented
API Documentation for libcloud, generated by pydoctor at 2013-02-18 10:41:20.