Module Expr Str Import alias Import alias Import alias Import alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr Str Str keyword NameLoad Expr Str FunctionDef arguments args defaults vararg body Expr Str Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad TupleLoad Str Assign NameStore Dict Str Str Str Str Str NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Return BinOpMod Str NameLoad orelse If Call NameLoad NameLoad NameLoad body Return BinOpMod Str NameLoad orelse If Call NameLoad NameLoad NameLoad body Return IfExp NameLoad Str Str orelse If Call NameLoad NameLoad TupleLoad NameLoad NameLoad body Return BinOpMod Str NameLoad orelse If CompareIs NameLoad NameLoad body Return Str orelse Raise NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Expr Yield BinOpMod Str NameLoad orelse Assign TupleStore NameStore NameStore NameLoad Expr Yield BinOpMod Str TupleLoad NameLoad Call NameLoad NameLoad decorator_list Assign NameStore Call AttributeLoad Str attr Call NameLoad NameLoad Assign NameStore IfExp NameLoad Call AttributeLoad Str attr GeneratorExp IfExp Call NameLoad NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num comprehension NameStore NameLoad Str Assign NameStore IfExp NameLoad Call AttributeLoad Str attr GeneratorExp BinOpMod Str IfExp Call NameLoad NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num comprehension NameStore NameLoad Str Assign NameStore BinOpMod Str Dict Str Str Str NameLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Lambda arguments args defaults Call AttributeLoad Call NameLoad Call AttributeLoad NameLoad attr attr Str Str Assign NameStore NameLoad While BoolOpOr UnaryOpNot NameLoad CompareIn NameLoad NameLoad body Assign NameStore BinOpMod Str Call NameLoad Assign NameStore NameLoad While BoolOpOr UnaryOpNot NameLoad CompareIn NameLoad NameLoad body Assign NameStore BinOpMod Str Call NameLoad Assign NameStore BinOpMod NameLoad Dict Str Str Str AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Str Str Num Num Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Return Call AttributeLoad Str attr GeneratorExp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str TryExcept body Expr Call AttributeLoad NameLoad attr handlers ExceptHandler body TryExcept body If NameLoad body Expr Call NameLoad Str handlers ExceptHandler body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Return Call NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr While Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Raise NameLoad Expr Call NameLoad NameLoad AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list
N/A N/A Utility functions N/A __builtin__ N/A uuid N/A functools N/A itertools ovs.log.logHandler LogHandler N/A LOGGER N/A N/A LogHandler get arakoon pyrakoon propagate False N/A Logger for code in this module update_argspec N/A N/A N/A argnames N/A N/A Wrap a callable to use real argument names

    When generating functions at runtime, one often needs to fall back to
    ``*args`` and ``**kwargs`` usage. Using these features require
    well-documented code though, and renders API documentation tools less
    useful.

    The decorator generated by this function wraps a decorated function,
    which takes ``**kwargs``, into a function which takes the given argument
    names as parameters, and passes them to the decorated function as keyword
    arguments.

    The given argnames can be strings (for normal named arguments), or tuples
    of a string and a value (for arguments with default values). Only a couple
    of default value types are supported, an exception will be thrown when an
    unsupported value type is given.

    Example usage::

        >>> @update_argspec('a', 'b', 'c')
        ... def fun(**kwargs):
        ...     return kwargs['a'] + kwargs['b'] + kwargs['c']

        >>> import inspect
        >>> tuple(inspect.getargspec(fun))
        (['a', 'b', 'c'], None, None, None)

        >>> print fun(1, 2, 3)
        6
        >>> print fun(1, c=3, b=2)
        6

        >>> print fun(1, 2)
        Traceback (most recent call last):
            ...
        TypeError: fun() takes exactly 3 arguments (2 given)


        >>> @update_argspec()
        ... def g():
        ...     print 'Hello'

        >>> tuple(inspect.getargspec(g))
        ([], None, None, None)

        >>> g()
        Hello

        >>> @update_argspec('name', ('age', None))
        ... def hello(**kwargs):
        ...     name = kwargs['name']
        ...
        ...     if kwargs['age'] is None:
        ...         return 'Hello, %s' % name
        ...     else:
        ...         age = kwargs['age']
        ...         return 'Hello, %s, who is %d years old' % (name, age)

        >>> tuple(inspect.getargspec(hello))
        (['name', 'age'], None, None, (None,))

        >>> hello('Nicolas')
        'Hello, Nicolas'
        >>> hello('Nicolas', 25)
        'Hello, Nicolas, who is 25 years old'

    :param argnames: Names of the arguments to be used
    :type argnames: iterable of :class:`str` or `(str, object)`

    :return: Decorator which wraps a given callable into one with a correct
        argspec
    :rtype: `callable`
     N/A argnames_ N/A tuple N/A N/A itertools chain argnames N/A N/A context N/A __builtins__ dict zip True False None N/A __builtin__ dict N/A __builtin__ zip True False _format N/A N/A value N/A N/A N/A Format a value for display in a function signature N/A N/A isinstance value unicode N/A N/A N/A u'%s' value N/A N/A N/A isinstance value str N/A N/A N/A '%s' value N/A N/A N/A isinstance value bool N/A N/A N/A value True False N/A N/A N/A isinstance value N/A int long N/A N/A N/A %d value N/A N/A N/A value None N/A N/A None N/A N/A TypeError N/A _generate_signature N/A N/A args N/A N/A N/A Format arguments for display in a function signature N/A arg args N/A N/A N/A isinstance arg str N/A N/A N/A N/A %s arg N/A N/A N/A arg default arg N/A N/A N/A %s=%s N/A arg N/A _format default N/A N/A template_signature N/A N/A ,  join N/A _generate_signature argnames_ N/A template_args N/A argnames_ N/A N/A ,  join N/A N/A N/A isinstance name str name N/A name N/A 0 N/A name argnames_ N/A template_argnames N/A argnames_ N/A N/A ,  join N/A N/A '%s' N/A N/A isinstance name str name N/A name N/A 0 N/A name argnames_ N/A fun_def_template N/A 
def %%(name)s(%(signature)s):
    %%(kwargs_name)s = dict(zip((%(argnames)s), (%(args)s)))

    return %%(orig_name)s(**%%(kwargs_name)s)
 N/A signature args argnames template_signature template_args template_argnames wrapper N/A N/A fun N/A N/A N/A 
        Decorating which wraps the decorated function in a callable which uses
        named arguments

        :param fun: Callable to decorate
        :type fun: `callable`

        :see: :func:`update_argspec`
         N/A random_suffix N/A N/A N/A N/A N/A N/A N/A str N/A N/A uuid uuid4 replace - N/A orig_function_name None N/A N/A N/A orig_function_name N/A orig_function_name argnames_ N/A N/A orig_function_name N/A _orig_%s N/A random_suffix N/A kwargs_name None N/A N/A N/A kwargs_name N/A kwargs_name argnames_ N/A N/A kwargs_name N/A _kwargs_%s N/A random_suffix N/A fun_def N/A fun_def_template N/A name orig_name kwargs_name N/A fun __name__ orig_function_name kwargs_name N/A code N/A compile fun_def <update_argspec> exec 0 1 N/A env N/A N/A context copy N/A N/A env N/A orig_function_name fun N/A N/A eval code env env N/A fun_wrapper N/A env N/A N/A fun __name__ N/A updated N/A N/A functools update_wrapper fun_wrapper fun N/A updated N/A N/A wrapper N/A format_doc N/A N/A doc N/A N/A N/A Try to format a docstring

    This function will split the given string on line boundaries, strip all
    lines, and stitch everything back together.

    :param doc: Docstring to format
    :type doc: :class:`str` or :class:`unicode`

    :return: Formatted docstring
    :rtype: :class:`unicode`
     N/A N/A isinstance doc str N/A N/A doc N/A N/A doc decode utf-8 N/A N/A N/A join N/A N/A N/A line strip N/A line N/A N/A doc splitlines N/A kill_coroutine N/A N/A coroutine log_fun N/A None N/A N/A Kill a coroutine by injecting :exc:`StopIteration`

    If the coroutine has exited already, we ignore any errors.

    The provided `log_fun` function will be called when an unexpected error
    occurs. It should take a *message* argument.

    Example:

        >>> import sys

        >>> def f():
        ...     a = yield 1
        ...     b = yield 3
        ...     c = yield 5

        >>> f_ = f()
        >>> print f_.next()
        1
        >>> print f_.send('2')
        3
        >>> kill_coroutine(f_)

        >>> def incorrect():
        ...     try:
        ...         yield 1
        ...         a = yield 2
        ...     except:
        ...         raise Exception
        ...     yield 3

        >>> i = incorrect()
        >>> print i.next()
        1
        >>> kill_coroutine(i,
        ...     lambda msg: sys.stdout.write('Error: %s' % msg))
        Error: Failure while killing coroutine

    :param coroutine: Coroutine to kill
    :type coroutine: `generator`
    :param log_fun: Function to call when an exception is encountered
    :type log_fun: `callable`
     N/A N/A N/A N/A N/A coroutine close N/A N/A N/A N/A N/A N/A log_fun N/A N/A N/A log_fun Failure while killing coroutine N/A N/A N/A N/A N/A process_blocking N/A N/A message stream N/A N/A N/A Process a message using a blocking stream API

    The given `message` will be serialized and written to the stream. Once the
    message was written, the result will be read using :func:`read_blocking`.

    The given stream object should implement `write` and `read` methods,
    somewhat like the file interface.

    :param message: Message to process
    :type message: :class:`pyrakoon.protocol.Message`
    :param stream: Stream to work on
    :type stream: :obj:`object`

    :return: Result of the command execution
    :rtype: :obj:`object`

    :see: :meth:`pyrakoon.client.AbstractClient._process`
    :see: :meth:`pyrakoon.protocol.Message.serialize`
    :see: :meth:`pyrakoon.protocol.Message.receive`
     N/A bytes_ N/A N/A message serialize N/A N/A N/A N/A stream write bytes_ N/A N/A read_blocking N/A N/A message receive N/A stream read N/A read_blocking N/A N/A receiver read_fun N/A N/A N/A Process message result parsing using a blocking stream read function

    Given a function to read a given amount of bytes from a result channel,
    this function handles the interaction with the parsing coroutine of a
    message (as passed to :meth:`pyrakoon.client.AbstractClient._process`).

    :param receiver: Message result parser coroutine
    :type receiver: :obj:`generator`
    :param read_fun: Callable to read a given number of bytes from a result
        stream
    :type read_fun: `callable`

    :return: Message result
    :rtype: :obj:`object`

    :raise TypeError:
        Coroutine didn't return a :class:`~pyrakoon.protocol.Result`

    :see: :meth:`pyrakoon.protocol.Message.receive`
     ovs.extensions.db.arakoon.pyrakoon.pyrakoon protocol N/A request N/A N/A receiver next N/A N/A isinstance request N/A protocol Request N/A N/A value N/A read_fun N/A request count N/A request N/A N/A receiver send value N/A N/A N/A isinstance request N/A protocol Result N/A N/A TypeError N/A N/A kill_coroutine receiver N/A LOGGER exception N/A N/A request value N/A