# HG changeset patch # User Jeff Hammel # Date 1411324297 25200 # Node ID e3fc1f75241d126114a32ec1c295fedf616d4aa7 # Parent 5245d7d0c1bfd380c8c2c6a2f9c8f03229353363 stubbing diff -r 5245d7d0c1bf -r e3fc1f75241d numerics/plot.py --- a/numerics/plot.py Sat Sep 20 18:48:58 2014 -0700 +++ b/numerics/plot.py Sun Sep 21 11:31:37 2014 -0700 @@ -9,7 +9,7 @@ plot foo.csv Generates plots of all columns of foo versus the first column. -The title is foo.csv unless overridden with ``--title`` +The title is foo.csv unless overridden with ``--title``. """ # imports @@ -19,8 +19,7 @@ import sys # module globals -__all__ = ['main', 'Parser'] -here = os.path.dirname(os.path.realpath(__file__)) +__all__ = ['main', 'PlotParser'] string = (str, unicode) def ensure_dir(directory): @@ -32,8 +31,9 @@ return directory -class Parser(argparse.ArgumentParser): +class PlotParser(argparse.ArgumentParser): """CLI option parser""" + def __init__(self, **kwargs): kwargs.setdefault('description', __doc__) argparse.ArgumentParser.__init__(self, **kwargs) @@ -48,13 +48,15 @@ def validate(self, options): """validate options""" + def main(args=sys.argv[1:]): """CLI""" # parse command line options - parser = Parser() + parser = PlotParser() options = parser.parse_args(args) + if __name__ == '__main__': main()