2.1. wc_utils package

2.1.2. Submodules

2.1.3. wc_utils.cache module

Caching

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2018-03-30
Copyright:2018, Karr Lab
License:MIT
class wc_utils.cache.Cache(directory='/root/.wc/cache/', hash_block_size=65536, **kwargs)[source]

Bases: diskcache.fanout.FanoutCache

Cache that shards keys (including the file content of keys that represent file names) and values

hash_block_size[source]

block size to use for hashing the content of file arguments

Type:int
DEFAULT_DIRECTORY = '/root/.wc/cache/'[source]
memoize(name=None, typed=False, expire=None, tag=None, filename_args=None, filename_kwargs=None)[source]

Memoizing cache decorator

Parameters:
  • name (str, optional) – name given for callable
  • typed (bool, optional) – cache different types separately
  • expire (float, optional) – seconds until arguments expire
  • tag (str, optional) – text to associate with arguments
  • filename_args (list, optional) – list of indices of arguments that represent filenames
  • filename_kwargs (list, optional) – list of keys of keyword arguments that represent filenames
Returns:

callable decorator

Return type:

types.FunctionType

2.1.4. wc_utils.quilt module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2018-08-03
Copyright:2018, Karr Lab
License:MIT
class wc_utils.quilt.QuiltManager(path, package, owner=None, token=None, verbose=None)[source]

Bases: object

Manages uploading and downloading of a Quilt package

path[source]

local path to save package or buit package from

Type:str
package[source]

identifier of the Quilt package

Type:str
owner[source]

identifier of the owner of the Quilt package

Type:str
token[source]

authentication token for Quilt

Type:str
verbose[source]

if True, display Quilt status

Type:bool
download(system_path=None, sym_links=False)[source]

Download Quilt package or, optionally, a single path within the package

Parameters:
  • system_path (str, optional) – if provided, download a specific path within the package (e.g. subdir/subsubdir/filename.ext) rather than downloading the entire package
  • sym_links (bool, optional) – if True, export files as symbolic links
Raises:

ValueError – if a specific file is requested, but there is no file with the same path within the package

gen_package_build_config()[source]

Generate the build configuration for a package

  • Force Quilt to retain Excel formatting by setting the transform of all .xls and .xlsx files to id
Returns:package build configuration
Return type:dict
get_owner_package()[source]

Get the full identifier (owner/package) of the Quilt package

Returns:full identifier of the Quilt package
Return type:str
get_package_path(system_path)[source]

Get the path for a file or directory within the Quilt package

Parameters:system_path (str) – path to file or directory
Returns:corresponding path within Quilt package to file or directory
Return type:str
get_token()[source]

Get token

Returns
str: authentication token for Quilt user
upload()[source]

Build and upload Quilt package

2.1.5. Module contents