# HG changeset patch # User Jeff Hammel # Date 1416604599 28800 # Node ID 3c3b793fcffc1e321f8ccf09fa22b2dbb934d608 # Parent 5b5e3a884b71b843e100abba44409c83280c6531 boilerplate diff -r 5b5e3a884b71 -r 3c3b793fcffc numerics/fields.py --- /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) + + +