Mercurial > hg > numerics
comparison numerics/manipulate.py @ 108:bad50c6bb243
notes to self
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 15 Mar 2015 10:12:33 -0700 |
parents | 19a5c2fb52bb |
children | 5790bcb30bd8 |
comparison
equal
deleted
inserted
replaced
107:19a5c2fb52bb | 108:bad50c6bb243 |
---|---|
7 | 7 |
8 # imports | 8 # imports |
9 import argparse | 9 import argparse |
10 import os | 10 import os |
11 import sys | 11 import sys |
12 from .convert import cast_columns | 12 from .convert import default_cast, cast_columns |
13 from .read import CSVParser | 13 from .read import CSVParser |
14 | 14 |
15 # module globals | 15 # module globals |
16 __all__ = ['ManipulationParser', 'main'] | 16 __all__ = ['ManipulationParser', 'main'] |
17 here = os.path.dirname(os.path.realpath(__file__)) | 17 here = os.path.dirname(os.path.realpath(__file__)) |
18 string = (str, unicode) | 18 string = (str, unicode) |
19 | 19 |
20 class ManipulationParser(CSVParser): | 20 class ManipulationParser(CSVParser): |
21 """CLI option parser for data manipulation""" | 21 """CLI option parser for data manipulation""" |
22 | 22 |
23 types = default_cast | |
24 | |
23 def __init__(self, **kwargs): | 25 def __init__(self, **kwargs): |
24 kwargs.setdefault('description', __doc__) | 26 kwargs.setdefault('description', __doc__) |
25 CSVParser.__init__(self, **kwargs) | 27 CSVParser.__init__(self, **kwargs) |
26 self.options = None | 28 self.options = None |
27 | 29 |
28 def typed_data(self): | 30 def typed_data(self): |
31 """return parsed and casted data""" | |
29 raise NotImplementedError('TODO') # -> record TODO items | 32 raise NotImplementedError('TODO') # -> record TODO items |
30 | 33 |
31 def main(args=sys.argv[1:]): | 34 def main(args=sys.argv[1:]): |
32 """CLI""" | 35 """CLI""" |
33 | 36 |