hydrotools.caches.hdf module#

HDF5-backed Caching Functionality#

Cache pandas objects resulting from long processes for later retrieval to avoid reprocessing.

Classes#

  • HDFCache

class hydrotools.caches.hdf.HDFCache(path: str, format: str = 'table', *args, **kwargs)#

Bases: object

close()#

Close the Pandas HDFStore.

property format#
get(function: Callable, key: str, *args, **kwargs)#

Check HDFStore for key and return the object. If key is not in the cache, then run function and store the result for later retrieval.

Parameters:
  • function (Callable) – Function to run to produce the object for storage.

  • key (str) – Key used to reference object in HDFStore.

  • *args – Additional arguments passed directly to function.

  • **kwargs – Additional arguments passed directly to function.

Returns:

Retrieve object from file.

Return type:

object

property path#
property store#