Module b.decorators

Part of bzrlib

No module docstring
Line # Kind Name Docs
213 Function use_fast_decorators Change the default decorators to be fast loading ones.
224 Function use_pretty_decorators Change the default decorators to be pretty ones.
28 Function _get_parameters Recreate the parameters for a function using introspection.
69 Function _pretty_needs_read_lock Decorate unbound to take out and release a read lock.
122 Function _fast_needs_read_lock Decorate unbound to take out and release a read lock.
154 Function _pretty_needs_write_lock Decorate unbound to take out and release a write lock.
187 Function _fast_needs_write_lock Decorate unbound to take out and release a write lock.
def _get_parameters(func):
Recreate the parameters for a function using introspection.

:return: (function_params, calling_params)
    function_params: is a string representing the parameters of the
        function. (such as "a, b, c=None, d=1")
        This is used in the function declaration.
    calling_params: is another string representing how you would call the
        function with the correct parameters. (such as "a, b, c=c, d=d")
        Assuming you sued function_params in the function declaration, this
        is the parameters to put in the function call.

    For example:

    def wrapper(%(function_params)s):
        return original(%(calling_params)s)
def _pretty_needs_read_lock(unbound):
Decorate unbound to take out and release a read lock.

This decorator can be applied to methods of any class with lock_read() and
unlock() methods.

Typical usage:
    
class Branch(...):
    @needs_read_lock
    def branch_method(self, ...):
        stuff
def _fast_needs_read_lock(unbound):
Decorate unbound to take out and release a read lock.

This decorator can be applied to methods of any class with lock_read() and
unlock() methods.

Typical usage:
    
class Branch(...):
    @needs_read_lock
    def branch_method(self, ...):
        stuff
def _pretty_needs_write_lock(unbound):
Decorate unbound to take out and release a write lock.
def _fast_needs_write_lock(unbound):
Decorate unbound to take out and release a write lock.
def use_fast_decorators():
Change the default decorators to be fast loading ones.

The alternative is to have decorators that do more work to produce nice-looking decorated functions, but this slows startup time.

def use_pretty_decorators():
Change the default decorators to be pretty ones.
API Documentation for BzrLib, generated by pydoctor at 2008-12-03 00:00:12.