Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

decorator: make keywords arguments of bool values from function attributes

Project Description

script:

from kwattr import kwattr

@kwattr.wait.chdir.min.max.hide
def run(*args, **kwargs):
    return args, kwargs

@kwattr.all.dirs
def scan(arg, idir=False, ifile=True, all=False, dirs=False):
    return arg, idir, ifile, all, dirs

print run.wait('sample.exe')
print run('sample.exe')
print run.wait.chdir('sample.exe')

out:

(('sample.exe',), {'max': False, 'chdir': False, 'hide': False, 'min': False, 'wait': True})
(('sample.exe',), {'max': False, 'chdir': False, 'hide': False, 'wait': False, 'min': False})
(('sample.exe',), {'max': False, 'chdir': True, 'hide': False, 'min': False, 'wait': True})

Release history Release notifications

This version
History Node

2.0

History Node

1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
kwattr-2.0.zip (2.8 kB) Copy SHA256 hash SHA256 Source None Aug 1, 2011

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page