Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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

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 Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting