changeset 1:12ac99c240ca default tip

* add documentation * add 1..10 autostep feature * bump version
author Jeff Hammel <k0scist@gmail.com>
date Wed, 10 Mar 2010 17:48:11 -0500
parents 1eea6356d2e5
children
files README.txt setup.py webcalc/webcalc.py
diffstat 3 files changed, 43 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.txt	Wed Mar 10 17:48:11 2010 -0500
@@ -0,0 +1,26 @@
+webcalc
+=======
+
+*through the web calculator*
+
+Usage
+-----
+
+webcalc uses the full path of the URL as a calculator:
+
+ ``http://127.0.0.1:5151/(5+3)/2``
+
+Should yield a ``text/plain`` document with contents ``4.0``.
+
+Query string arguments may be used to iterate over arguments:
+
+ ``http://127.0.0.1:5151/(5+a)/2?a=1..10``
+
+Values and ranges may be comma separated (e.g. ``a=1,3,5..10``).
+Ranges may be specified as *start, step, end*.  If *step* is omitted,
+it is taken to be 1.0.
+
+TODO
+----
+
+ * add multiple front ends, including a graphing calculator
--- a/setup.py	Mon Sep 07 15:09:03 2009 -0400
+++ b/setup.py	Wed Mar 10 17:48:11 2010 -0500
@@ -1,12 +1,19 @@
 from setuptools import setup, find_packages
+import os
 
-version = "0.1"
+# get the description from the README
+try:
+    filename = os.path.join(os.path.dirname(__file__), 'README.txt')
+    description = file(filename).read()
+except:
+    description = ''
+
+version = "0.1.1"
 
 setup(name='webcalc',
       version=version,
       description="web-based calculator",
-      long_description="""
-""",
+      long_description=description,
       classifiers=[], # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
       author='Jeff Hammel',
       author_email='k0scist@gmail.com',
--- a/webcalc/webcalc.py	Mon Sep 07 15:09:03 2009 -0400
+++ b/webcalc/webcalc.py	Wed Mar 10 17:48:11 2010 -0500
@@ -129,7 +129,13 @@
                 continue
             except ValueError:
                 pass
-            start, step, end = token.split('..')
+            count = token.count('..')
+            assert count in set([1,2])
+            if count == 1:
+                start, end = token.split('..')
+                step = 1.0
+            else: # count == 2
+                start, step, end = token.split('..')
             start = float(start)
             step = float(step)
             end = float(end)