# HG changeset patch # User Jeff Hammel # Date 1424992368 28800 # Node ID 0df8bcb6d521ce8f55ee525cd53a02b1fcbe8a16 # Parent 18c0820bfe12f35f0a78f712988d90196f8cc7b4 stubbing: unicode histograms diff -r 18c0820bfe12 -r 0df8bcb6d521 numerics/histogram.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/numerics/histogram.py Thu Feb 26 15:12:48 2015 -0800 @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" + +Unicode is awesome; see http://www.alanwood.net/unicode/block_elements.html +""" + +blocks = """ +█ +▉ +▊ +▋ +▌ +▍ +▎ +▏ +""" + +# imports +import argparse +import os +import subprocess +import sys +import time +from .read import CSVParser + +# module globals +__all__ = ['HistogramParser', 'main'] + +class HistogramParser(argparse.ArgumentParser): + """histogram CLI option parser""" + + def __init__(self, **kwargs): + kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter) + kwargs.setdefault('description', __doc__) + argparse.ArgumentParser.__init__(self, **kwargs) + self.add_argument('-n', '--bins', dest='n_bins', type=int, + help="number of bins") + self.options = None + + +def main(args=sys.argv[1:]): + """CLI""" + + # parse command line options + parser = HistogramParser() + options = parser.parse_args(args) + + +if __name__ == '__main__': + main() + + diff -r 18c0820bfe12 -r 0df8bcb6d521 setup.py --- a/setup.py Mon Feb 23 10:50:13 2015 -0800 +++ b/setup.py Thu Feb 26 15:12:48 2015 -0800 @@ -17,6 +17,7 @@ kw['entry_points'] = """ [console_scripts] cat-columns = numerics.cat_columns:main + histogram = numerics.histogram:main interpolate = numerics.interpolation:main manipulate = numerics.manipulate:main plot = numerics.plot:main