Skip to main content

Module wrapper Python library

Project description

module-wrapper - module wrapper Python library

Installation

To install from PyPI: https://pypi.org/project/module-wrapper/ run:

$ pip install module-wrapper

Usage

Example from https://github.com/rominf/aioify:

from functools import wraps, partial
import asyncio

import module_wrapper


__all__ = ['aioify']


def wrap(func):
    @wraps(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.

Source Distribution

module-wrapper-0.1.4.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

module_wrapper-0.1.4-py2.py3-none-any.whl (16.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file module-wrapper-0.1.4.tar.gz.

File metadata

  • Download URL: module-wrapper-0.1.4.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.11.5 CPython/3.7.0 Linux/4.18.7-1-default

File hashes

Hashes for module-wrapper-0.1.4.tar.gz
Algorithm Hash digest
SHA256 dbadbd4b0cc95a69026f61c26644fb11aa92f0629a6f577b24472e4b7d9a5ee1
MD5 3f1f62272e2d624260bd8c807fa2b43f
BLAKE2b-256 f1b75add2199ae526f681d30dd1ea5110c04f9db4c4b808f47c08221ff6dca4f

See more details on using hashes here.

File details

Details for the file module_wrapper-0.1.4-py2.py3-none-any.whl.

File metadata

  • Download URL: module_wrapper-0.1.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.11.5 CPython/3.7.0 Linux/4.18.7-1-default

File hashes

Hashes for module_wrapper-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1e924d0177cc2bbc25ff09d25f568f902970d6f49d41f3e628d36cf2402c7ff3
MD5 4fc2863da91e9e88a8e6f4c5ee42598e
BLAKE2b-256 ccce84800d347f66d192b4b95fd1d8374f7a9551e2a34e09ea1285c9bc8dc753

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page