skip to navigation
skip to content

resolver_deco 1.0.4

Decorator for resolve function arguments

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
 
File Type Py Version Uploaded on Size
resolver_deco-1.0.4.tar.bz2 (md5) Source 2016-07-19 1KB
resolver_deco-1.0.4.tar.gz (md5) Source 2015-05-30 1KB