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})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kwattr-2.0.zip
(2.8 kB
view details)
File details
Details for the file kwattr-2.0.zip.
File metadata
- Download URL: kwattr-2.0.zip
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1e434a471206312a61f8d2ecef4a2b854e3a14bf5e2e17c876915c49e5c9e6c
|
|
| MD5 |
d2228ec9b7de7a94519346a0ea0a6ae6
|
|
| BLAKE2b-256 |
9e9a70dddf7b4ad5c500671fe0fc0d313ebec104d3ea51b395e6af4a6413cd38
|