# HG changeset patch # User Jeff Hammel # Date 1431732934 25200 # Node ID 8508dbeb975967cff573b2a7ff96fb7ca277f7a1 # Parent 28215de613426b28b00823cf8162fd99a01dcdee more stubbing diff -r 28215de61342 -r 8508dbeb9759 numerics/normalize.py --- 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()