Exscript.util.impl module

Development tools.

class Exscript.util.impl.Context(obj)[source]

Bases: Exscript.util.impl._Context

context()[source]
class Exscript.util.impl.Decorator(obj)[source]

Bases: future.types.newobject.newobject

__init__(obj)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

Exscript.util.impl.add_label(obj, name, **kwargs)[source]

Labels an object such that it can later be checked with get_label().

Parameters:
  • obj (object) – The object that is labeled.
  • name (str) – A label.
  • kwargs (dict) – Optional values to store with the label.
Return type:

object

Returns:

The labeled function.

Exscript.util.impl.copy_labels(src, dst)[source]

Copies all labels of one object to another object.

Parameters:
  • src (object) – The object to check read the labels from.
  • dst (object) – The object into which the labels are copied.
Exscript.util.impl.debug(func)[source]

Decorator that prints a message whenever a function is entered or left.

Exscript.util.impl.deprecated(func)[source]

A decorator for marking functions as deprecated. Results in a printed warning message when the function is used.

Exscript.util.impl.deprecation(msg)[source]

Prints a deprecation warning.

Exscript.util.impl.format_exception(thetype, ex, tb)[source]

This function is a drop-in replacement for Python’s traceback.format_exception().

Since traceback objects can not be pickled, Exscript is forced to manipulate them before they are passed accross process boundaries. This leads to the fact the Python’s traceback.format_exception() no longer works for those objects.

This function works with any traceback object, regardless of whether or not Exscript manipulated it.

Exscript.util.impl.get_label(obj, name)[source]

Checks whether an object has the given label attached (see add_label()) and returns the associated options.

Parameters:
  • obj (object) – The object to check for the label.
  • name (str) – A label.
Return type:

dict or None

Returns:

The optional values if the label is attached, None otherwise.

Exscript.util.impl.serializeable_exc_info(thetype, ex, tb)[source]

Since traceback objects can not be pickled, this function manipulates exception info tuples before they are passed accross process boundaries.

Exscript.util.impl.serializeable_sys_exc_info()[source]

Convenience wrapper around serializeable_exc_info, equivalent to serializeable_exc_info(sys.exc_info()).

Exscript.util.impl.synchronized(func)[source]

Decorator for synchronizing method access.