The sushy.utils Module

The sushy.utils Module

sushy.utils.get_members_identities(members)

Extract and return a tuple of members identities

Parameters:members – A list of members in JSON format
Returns:A tuple containing the members paths
sushy.utils.get_sub_resource_path_by(resource, subresource_name)

Helper function to find the subresource path

Parameters:
  • resource – ResourceBase instance on which the name gets queried upon.
  • subresource_name – name of the resource field to fetch the @odata.id’ from.
sushy.utils.int_or_none(x)

Given a value x it cast as int or None

Parameters:x – The value to transform and return
Returns:Either None or x cast to an int
sushy.utils.max_safe(iterable, default=0)

Helper wrapper over builtin max() function.

This function is just a wrapper over builtin max() w/o key argument. The default argument specifies an object to return if the provided iterable is empty. Also it filters out the None type values. :param iterable: an iterable :param default: 0 by default

sushy.utils.revert_dictionary(dictionary)

Given a dictionary revert it’s mapping

Parameters:dictionary – A dictionary to be reverted
Returns:A dictionary with the keys and values reverted
sushy.utils.sanitize(item)

Remove passwords from the item.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.