cwl_utils.utils

Miscellaneous utility functions.

Attributes

fast_yaml

Functions

bytes2str_in_dicts(inp)

Convert any present byte string to unicode string, inplace.

load_linked_file(base_url, link[, is_import])

From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py .

normalize_to_map(obj, key_field)

From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py .

normalize_to_list(obj, key_field, value_field)

From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py .

resolved_path(base_url, link)

Derive a resolved path.

singularity_supports_userns()

Confirm if the version of Singularity install supports the --userns flag.

yaml_dumps(obj)

Shortcut.

Module Contents

cwl_utils.utils.fast_yaml
cwl_utils.utils.bytes2str_in_dicts(inp)

Convert any present byte string to unicode string, inplace.

input is a dict of nested dicts and lists

Parameters:

inp (Union[MutableMapping[str, Any], MutableSequence[Any], Any])

Return type:

Union[str, MutableSequence[Any], MutableMapping[str, Any]]

cwl_utils.utils.load_linked_file(base_url, link, is_import=False)

From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py .

Parameters:
Return type:

Tuple[Any, urllib.parse.ParseResult]

cwl_utils.utils.normalize_to_map(obj, key_field)

From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py .

Parameters:
  • obj (Union[List[Any], Dict[str, Any]])

  • key_field (str)

Return type:

Dict[str, Any]

cwl_utils.utils.normalize_to_list(obj, key_field, value_field)

From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py .

Parameters:
  • obj (Union[List[Any], Dict[str, Any]])

  • key_field (str)

  • value_field (Optional[str])

Return type:

List[Any]

cwl_utils.utils.resolved_path(base_url, link)

Derive a resolved path.

This function will 1. Resolve the path, which means dot and double dot components are resolved 2. Use the OS appropriate path resolution for local paths, and network appropriate resolution for network paths

From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py

Parameters:
Returns:

new URL that allows us to retrieve the linked document

Return type:

urllib.parse.ParseResult

cwl_utils.utils.singularity_supports_userns()

Confirm if the version of Singularity install supports the –userns flag.

Return type:

bool

cwl_utils.utils.yaml_dumps(obj)

Shortcut.

Don’t use if you have a file descriptor (like sys.stdout) available.

Parameters:

obj (Any)

Return type:

str