Welcome to module-wrapper’s documentation!


To install from PyPI run:

$ pip install module-wrapper


Example from aioify:

from functools import wraps, partial
import asyncio

import module_wrapper

__all__ = ['aioify']

def wrap(func):
    async def run(*args, loop=None, executor=None, **kwargs):
        if loop is None:
            loop = asyncio.get_event_loop()
        pfunc = partial(func, *args, **kwargs)
        return await loop.run_in_executor(executor, pfunc)
    return run

def aioify(obj, name=None):
    def create(cls):
        return 'create', wrap(cls)

    return module_wrapper.wrap(obj=obj, wrapper=wrap, methods_to_add={create}, name=name)


Indices and tables