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  DotDict
 Dictionary subclass that allows accessing keys via dot notation. More...
class  ResultsIterator
 This object will iterate over all the results for a given type of listing, no matter how many items exist. 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_unicode
 Generates a random name; useful for testing.
def random_ascii
 Generates a random name; useful for testing.
def coerce_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_until: 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 rfc2822_format
 Takes either a date, a datetime, or a string, and returns a string that represents the value in RFC 2822 format.
def to_timestamp
 Takes a value that is either a Python date, datetime, or a string representation of a date/datetime value.
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 params_to_dict
 Updates the 'dct' dictionary with the 'params' dictionary, filtering out all those whose param value is None.
def dict_to_qs
 Takes a dictionary and uses it to create a query string.
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 case_insensitive_update
 Given two dicts, updates the first one with the second, but considers keys that are identical except for case to be the same.
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