Module wrapper Python library
Project description
module-wrapper - module wrapper Python library
module-wrapper
contains wrap
function, which is used to wrap module, class, function or another variable
recursively.
Installation
To install from PyPI run:
$ pip install module-wrapper
Usage
Example from 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
Release history Release notifications | RSS feed
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.2.0.tar.gz
(9.9 kB
view hashes)
Built Distribution
Close
Hashes for module_wrapper-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca9fcd1476ec91cd33820ab651ed175748ef340ebe7bb337f93428cc6cf436c2 |
|
MD5 | 981e82701eacebc40222519a7819b0c0 |
|
BLAKE2b-256 | d0e4f26fe604cef1650ef909467259df3c3414731adda9190dec37855fa40f26 |