wholecell.utils.data

Miscellaneous data structure utilities.

wholecell.utils.data.dissoc(mapping, keys)[source]

Dissociate: Return a new dict like mapping without the given keys. See also dissoc_strict().

Parameters:
Return type:

dict

wholecell.utils.data.dissoc_strict(mapping, keys)[source]

Dissociate: Return a new dict like mapping without the given keys. Raises a KeyError if any of these keys are not in the given mapping.

Parameters:
Return type:

dict

wholecell.utils.data.expand_keyed_env_vars(data)[source]

If data is a dict, return a new dict where each _keyed environment ‘$VARIABLE’ value is expanded into a non-underscore entry, e.g.:

{‘_foo’: ‘$HOME’} –> {‘foo’: ‘/Users/franklin’, ‘_foo’: ‘$HOME’}

To trigger expansion, an entry must have a key string starting with ‘_’ and a value string starting with ‘$’ that names an environment variable.

Parameters:

data (Any) –

Return type:

Any

wholecell.utils.data.select_keys(mapping, keys, **kwargs)[source]

Return a dict of the selected keys from mapping plus the kwargs.

Parameters:
Return type:

Dict[str, Any]

wholecell.utils.data.startswith(obj, prefix)[source]

Return True if obj is a string that starts with the given prefix.

Parameters:
  • obj (Any) –

  • prefix (str) –

Return type:

bool