Mercurial > hg > numerics
changeset 163:8508dbeb9759
more stubbing
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 15 May 2015 16:35:34 -0700 |
parents | 28215de61342 |
children | c16940bd2cee |
files | numerics/normalize.py |
diffstat | 1 files changed, 3 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/numerics/normalize.py Fri May 15 16:30:34 2015 -0700 +++ b/numerics/normalize.py Fri May 15 16:35:34 2015 -0700 @@ -7,45 +7,22 @@ # imports import sys +from .manipulate import ManipulationParser # module globals __all__ = ['main', 'NormalizationParser'] -class Parser(argparse.ArgumentParser): +class NormalizationParser(ManipulationParser): """CLI option parser""" - def __init__(self, **kwargs): - kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter) - kwargs.setdefault('description', __doc__) - argparse.ArgumentParser.__init__(self, **kwargs) - self.add_argument('--monitor', dest='monitor', - type=float, metavar='SLEEP', - help="run in monitor mode") - self.options = None - def parse_args(self, *args, **kw): - options = argparse.ArgumentParser.parse_args(self, *args, **kw) - self.validate(options) - self.options = options - return options - - def validate(self, options): - """validate options""" def main(args=sys.argv[1:]): """CLI""" # parse command line options - parser = Parser() + parser = NormalizationParser() options = parser.parse_args(args) - try: - while True: - if options.monitor: - time.sleep(options.monitor) - else: - break - except KeyboardInterrupt: - pass if __name__ == '__main__': main()