Skip to main content

Decorator for resolve function arguments

Project description

https://api.travis-ci.org/zzzsochi/resolver_deco.svg https://coveralls.io/repos/zzzsochi/resolver_deco/badge.svg

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for resolver_deco, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size resolver_deco-1.0.4.tar.bz2 (1.9 kB) File type Source Python version None Upload date Hashes View
Filename, size resolver_deco-1.0.4.tar.gz (1.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page