Mercurial > hg > numerics
view numerics/manipulate.py @ 92:5b25e0be78aa
wip
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 02 Mar 2015 16:08:39 -0800 |
parents | 82a18c9337c3 |
children | 895ad896023a |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- """ manipulate CSV data """ # imports import argparse import os import sys from .convert import cast_columns from .read import CSVParser # module globals __all__ = ['main', 'ManipulationParser'] here = os.path.dirname(os.path.realpath(__file__)) string = (str, unicode) class ManipulationParser(CSVParser): """CLI option parser for data manipulation""" def __init__(self, **kwargs): kwargs.setdefault('description', __doc__) CSVParser.__init__(self, **kwargs) self.add_argument('--list', '--entries', '--list-entries', dest='list_entries', nargs='?', const=0, type=int, help="list all entries for this column") self.options = None def typed_data(self): raise NotImplementedError('TODO') # -> record TODO items def main(args=sys.argv[1:]): """CLI""" # parse command line options parser = Parser() options = parser.parse_args(args) if options.list_entries: raise NotImplementedError('TODO') # -> record TODO items else: # print help print (parser.help()) parser.exit() if __name__ == '__main__': main()