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 tests.py -v
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 Distributions
resolver_deco-1.0.4.tar.gz
(1.8 kB
view details)
resolver_deco-1.0.4.tar.bz2
(1.9 kB
view details)
File details
Details for the file resolver_deco-1.0.4.tar.gz
.
File metadata
- Download URL: resolver_deco-1.0.4.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 110d280171bd7633100d6f1930e7eb7f886f297c4abfcee9f5c675f929bc74fb |
|
MD5 | b18f93e2a8b95a6b73778afe9a847444 |
|
BLAKE2b-256 | 371130f030e43dd1cde8f1b8dadb6966646b767d8c83c2d168f4a37c5b86214a |
File details
Details for the file resolver_deco-1.0.4.tar.bz2
.
File metadata
- Download URL: resolver_deco-1.0.4.tar.bz2
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd35091b485f71c2c5f91b4592a6c9c0c4b8343696212043443b111772b7fd14 |
|
MD5 | dc80fee0a5341b66b6ffcb251bf2db32 |
|
BLAKE2b-256 | f4b53700465decc1148a2f55dfa2b886c7ece6b50575f510d179fb778dd00855 |