File: example12.py

package info (click to toggle)
python-plac 1.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 620 kB
  • sloc: python: 2,185; lisp: 57; makefile: 30; sh: 20
file content (19 lines) | stat: -rw-r--r-- 375 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# example12.py
import plac


@plac.annotations(
   opt=('some option', 'option'),
   args='default arguments',
   kw='keyword arguments')
def main(opt, *args, **kw):
    if opt:
       yield 'opt=%s' % opt
    if args:
       yield 'args=%s' % str(args)
    if kw:
       yield 'kw=%s' % kw

if __name__ == '__main__':
    for output in plac.call(main):
       print(output)