pdk.Util.PyUtils ($Date: 2002/12/04 08:02:54 $)
index
pdk/Util/PyUtils.py

Utilities for Python internals.

FOG 12.2002

 
Functions
            
allbases(_class, reverse=1)
Purpose:returns a list of all base classes of a class
Detail:use the reverse flag to have classes high in the hierarchy go last in the list.
delegate_attribute_access(delegator, delegee, attributes=None)
delegates attribute access from the instance delegator to the instance delegee for the attributes given in attributes (or for all attributes of delegator, determined with the builtin dir function, if no attribute names are passed). Use at your own risk ;-)
getmoduledocstring(pyFileName)
retrieves the doc string from a module.
getmodulename(object)
attempts to determine the name of the module in which the object object is defined. This works for code objects, user-defined functions and methods, instances with a __call__ method, and classes; for all other object types, the function returns None.
getslots(_class)
returns a list of all slots of the Python class _class.
getslotvalues(instance)
returns a dictionary of all values for all slots of the Python instance instance.
gettraceback()
fetches the last traceback from sys.exc_info and returns a formatted string from it.
importmodule(fileName, fileDirL=[])
load the module given by fileName with the imp hooks. fileName can either be a full path name or a base name without path information; in the latter case, a list of search paths can be passed in fileDirL.
resolve_class(className, globalNameSpace=None, localNameSpace=None)
will find a class specified like this: ::

<package>.<subpackage1>.<...>.<class>

If className contains a dot, calls resolve_module on the module prefix with globalNameSpace and localNameSpace as arguments and then returns the class as the module`s attribute. Otherwise, className is looked up in globalNameSpace, which defaults to the builtin globals.

resolve_module(moduleName, globalNameSpace=None, localNameSpace=None)
imports the module named moduleName, which may be a dotted path, using globalNameSpaceD and localNameSpaceD as globals and locals, respectively.
setslotvalues(instance, slotValueD)
sets all key:value pairs given in slotValueD as attributes of instance. Checks first if any of the keys in slotValueD is _not_ a slot of instance, in which case a ValueError is raised.
methodproxy(method, callback=None)
factory function to create a _WeakMethod object for method.
 
Author
            
$Author: gathmann $