Skip to main content

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


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)

Uploaded Source

File details

Details for the file resolver_deco-1.0.2.tar.gz.

File metadata

File hashes

Hashes for resolver_deco-1.0.2.tar.gz
Algorithm Hash digest
SHA256 588e71140c170a782e91621b015434da0835992b8b1e48a3ee6a247c952e56e5
MD5 79964587a6e3628604bf98c754bf85c6
BLAKE2b-256 abadd5110d1637719d0a162be9ce9ce95658eda9cbe119876c61230bdafcbc33

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page