Decorator for resolve function arguments
Project description
Usage
from resolver_deco import resolver
@resolver('obj')
def get_attribute(obj, name):
return getattr(obj, name)
import os.path
assert get_attribute('os.path', 'isdir') == os.path.isdir
You can resolve more than one argument:
from resolver_deco import resolver
@resolver('obj', 'value')
def set_attribute(obj, name, value):
return setattr(obj, name, value)
set_attribute('collections.UserDict', 'val', 'os.path')
import collections, os.path
assert collections.UserDict.val is os.path
Tests
$ pip install pytest
$ py.test
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
resolver_deco-1.0.2.tar.gz
(1.7 kB
view details)
File details
Details for the file resolver_deco-1.0.2.tar.gz
.
File metadata
- Download URL: resolver_deco-1.0.2.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 588e71140c170a782e91621b015434da0835992b8b1e48a3ee6a247c952e56e5 |
|
MD5 | 79964587a6e3628604bf98c754bf85c6 |
|
BLAKE2b-256 | abadd5110d1637719d0a162be9ce9ce95658eda9cbe119876c61230bdafcbc33 |