Skip to main content

Module wrapper Python library

Project description

module-wrapper - module wrapper Python library

License PyPI - Python Version PyPI Documentation Status

module-wrapper contains wrap function, which is used to wrap module, class, function or another variable recursively.


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)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for module-wrapper, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size module_wrapper-0.3.1-py3-none-any.whl (10.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size module-wrapper-0.3.1.tar.gz (10.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page