Mercurial > hg > configuration
comparison example/argparse_undefined.py @ 143:2825b0fdf80e
wip
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Mon, 01 Dec 2014 18:24:01 -0800 |
| parents | efd2d3330296 |
| children | df5350aee9c3 |
comparison
equal
deleted
inserted
replaced
| 142:efd2d3330296 | 143:2825b0fdf80e |
|---|---|
| 13 Undefined = Undefined() | 13 Undefined = Undefined() |
| 14 | 14 |
| 15 class UndefinedArgumentParser(argparse.ArgumentParser): | 15 class UndefinedArgumentParser(argparse.ArgumentParser): |
| 16 | 16 |
| 17 def __init__(self, *args, **kwargs): | 17 def __init__(self, *args, **kwargs): |
| 18 argparse.ArgumentParser.__init__(self, *args, **kwargs) | |
| 18 | 19 |
| 19 def add_argument(self, *args, **kwargs): | 20 def add_argument(self, *args, **kwargs): |
| 20 kwargs.setdefault('default', Undefined) | 21 kwargs.setdefault('default', Undefined) |
| 21 return argparse.ArgumentParser.add_argument | 22 return argparse.ArgumentParser.add_argument |
| 22 | 23 |
