Mercurial > hg > numerics
changeset 39:3c3b793fcffc
boilerplate
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 21 Nov 2014 13:16:39 -0800 |
parents | 5b5e3a884b71 |
children | 37378374b218 |
files | numerics/fields.py |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/numerics/fields.py Fri Nov 21 13:16:39 2014 -0800 @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +fields CSV +""" + +# imports +import csv +string = (str, unicode) + +class FieldsCSV(object): + """fields-based CSV""" + + fields = [] # ABC + + @classmethod + def names(cls): + return [field[0] for field in cls.fields] + + def parse(f): + if isinstance(f, string): + with open(f) as _f: + return self.parse(_f) + + +