pyrax
Python Bindings for the Rackspace Cloud
Classes | Packages | Functions | Variables
pyrax/utils.py File Reference

Classes

class  SelfDeletingTempfile
 Convenience class for dealing with temporary files. More...
class  SelfDeletingTempDirectory
 Convenience class for dealing with temporary folders and the files within them. More...
class  _WaitThread
 Threading class to wait for object status in the background. More...

Packages

namespace  pyrax::utils

Functions

def runproc
 Convenience method for executing operating system commands.
def get_checksum
 Returns the MD5 checksum in hex for the given content.
def random_name
 Generates a random name; useful for testing.
def coerce_string_to_list
 For parameters that can take either a single string or a list of strings, this function will ensure that the result is a list containing the passed values.
def folder_size
 Returns the total bytes for the specified path, optionally ignoring any files which match the 'ignore' parameter.
def add_method
 Adds an instance method to an object.
def wait_until
 When changing the state of an object, it will commonly be in a transitional state until the change is complete.
def wait_for_build
 Designed to handle the most common use case for wait_unti: an object whose 'status' attribute will end up in either 'ACTIVE' or 'ERROR' state.
def iso_time_string
 Takes either a date, datetime or a string, and returns the standard ISO formatted string for that date/time, with any fractional second portion removed.
def get_id
 Returns the 'id' attribute of 'id_or_obj' if present; if not, returns 'id_or_obj'.
def get_name
 Returns the 'name' attribute of 'name_or_obj' if present; if not, returns 'name_or_obj'.
def match_pattern
 Compares `nm` with the supplied patterns, and returns True if it matches at least one.
def update_exc
 Adds additional text to an exception's error message.
def env
 Returns the first environment variable set if none are non-empty, defaults to "" or keyword arg default.
def unauthenticated
 Adds 'unauthenticated' attribute to decorated function.
def isunauthenticated
 Checks to see if the function is marked as not requiring authentication with the decorator.
def safe_issubclass
 Like issubclass, but will just return False if not a class.
def import_class
 Returns a class from a string including module and class.
def slugify
 Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens.

Variables

 trace = pudb.set_trace
 All Classes Namespaces Files Functions Variables Properties