changeset 95:a027870e7a93

wip
author Jeff Hammel <k0scist@gmail.com>
date Tue, 03 Mar 2015 18:10:34 -0800
parents b5aea10e611d
children 1feb14ee7629
files numerics/text_display.py setup.py
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/text_display.py	Mon Mar 02 19:24:26 2015 -0800
+++ b/numerics/text_display.py	Tue Mar 03 18:10:34 2015 -0800
@@ -14,9 +14,24 @@
 block = ''
 
 
-def frac(*fractions, width=20, bar='│'):
+def iterable(obj):
+    """is `obj` iterable?"""
+    # TODO: should probably go elsewhere
+    try:
+        iter(obj)
+        return True
+    except TypeError:
+        return False
+
+
+def frac(fractions, width=20, bar='│'):
     """display fractions"""
-    raise NotImplementedError('TODO') # -> record TODO items
+    if not iterable(fractions):
+        # convert single item to list
+        fractions = [fractions]
+    retval = []
+    for fraction in fractions:
+        raise NotImplementedError('TODO') # -> record TODO items
 
 
 class FracParser(argparse.ArgumentParser):
--- a/setup.py	Mon Mar 02 19:24:26 2015 -0800
+++ b/setup.py	Tue Mar 03 18:10:34 2015 -0800
@@ -17,6 +17,7 @@
     kw['entry_points'] = """
     [console_scripts]
     cat-columns = numerics.cat_columns:main
+    display-fraction = numerics.text_display:main
     histogram = numerics.histogram:main
     interpolate = numerics.interpolation:main
     manipulate = numerics.manipulate:main