tron.utils.proxy module¶
Utilities for creating classes that proxy function calls.
- class tron.utils.proxy.AttributeProxy(dest_obj, attribute_list=None)¶
Bases:
objectProxy attribute lookups to another object.
- add(attribute_name)¶
- perform(attribute_name)¶
- class tron.utils.proxy.CollectionProxy(obj_list_getter, definition_list=None)¶
Bases:
objectProxy attribute lookups to a sequence of objects.
- add(attribute_name, aggregate_func, is_callable)¶
Add attributes to proxy, the aggregate function to use on the sequence of returned values, and a boolean identifying if this attribute is a callable or not.
attribute_name - the name of the attribute to proxy aggregate_func - a function that takes a sequence as its only argument callable - if this attribute is a callable on every object in
the obj_list (boolean)
- perform(name)¶
Attempt to perform the proxied lookup. Raises AttributeError if the name is not defined.
- tron.utils.proxy.attr_proxy(name, func)¶
- tron.utils.proxy.func_proxy(name, func)¶