[pypy-svn] r20415 - pypy/dist/pypy/doc/statistic

ericvrp at codespeak.net ericvrp at codespeak.net
Wed Nov 30 10:52:58 CET 2005


Author: ericvrp
Date: Wed Nov 30 10:52:57 2005
New Revision: 20415

Modified:
   pypy/dist/pypy/doc/statistic/format.py
   pypy/dist/pypy/doc/statistic/release_dates.csv
Log:
added release dates to the plot


Modified: pypy/dist/pypy/doc/statistic/format.py
==============================================================================
--- pypy/dist/pypy/doc/statistic/format.py	(original)
+++ pypy/dist/pypy/doc/statistic/format.py	Wed Nov 30 10:52:57 2005
@@ -27,7 +27,8 @@
         return [float(elt) for elt in row]
     except ValueError:
         pass
-    parsedate(first)
+    if first[0] == '"':
+        return [str(elt) for elt in row]
     return [parsedate(elt) for elt in row]
 
 def parsedate(s):
@@ -38,27 +39,26 @@
         result = parser.parse(s)
     return pylab.date2num(result)
 
-def date2str(i, dates):
-    l = len(dates)
-    if i == 0 or i == l-1 or i == int(l/2):
-        d = dates[i]
-        return str(pylab.num2date(d))[:7]
-    else:
-        return ""
-
 colors = "brg"
 
 def txt2png(p):
     print p
     title, axis, data = get_data(p)
     dates = data[0]
-    args = []
+
+    release_title, release_axis, release_data = get_data( py.path.local("release_dates.csv") )
+    release_dates = release_data[0]
+ 
     ax = pylab.subplot(111)
     for i, d in enumerate(data[1:]):
         args = [dates, d, colors[i]]
         pylab.plot_date(*args)
+
+    for i, release_date in enumerate(release_dates):
+        pylab.axvline(release_date, color="g")
+    #pylab.axvspan(dates[0]+1.25, dates[-1]-1.55, facecolor="g", alpha=0.5)
+
     pylab.legend(axis[1:], "upper left")
-    loc, labels = pylab.xticks()
     pylab.xlabel(axis[0])
     pylab.ylabel(axis[1])
     ticklabels = ax.get_xticklabels()
@@ -66,18 +66,18 @@
     ax.autoscale_view()
     ax.grid(True)
     pylab.title(title)
+
     pylab.savefig(p.purebasename + ".png")
     pylab.savefig(p.purebasename + ".eps")
  
-def main():
-    for p in py.path.local().listdir("*.txt"):
-        txt2png(p)
-
 if __name__ == '__main__':
-    if py.std.sys.argv[1] == "--all":
-        for p in py.path.local().listdir():
-            if p.ext != ".txt":
-                continue
-            py.std.os.system("python %s %s" % (py.std.sys.argv[0], p.basename))
-    else:
-        txt2png(py.path.local(py.std.sys.argv[1]))
+    args = py.std.sys.argv
+    if len(args) == 1:
+        print "usage: %s <filenames> <--all>" % args[0]
+        py.std.sys.exit()
+    for arg in args[1:]:
+        if arg == "--all":
+            for p in py.path.local().listdir("*.txt"):
+                py.std.os.system("python %s %s" % (args[0], p.basename))
+        else:
+            txt2png(py.path.local(arg))

Modified: pypy/dist/pypy/doc/statistic/release_dates.csv
==============================================================================
--- pypy/dist/pypy/doc/statistic/release_dates.csv	(original)
+++ pypy/dist/pypy/doc/statistic/release_dates.csv	Wed Nov 30 10:52:57 2005
@@ -1,6 +1,6 @@
 PyPy releases
 date, release
-2005-05-20 , 0.6
-2005-05-21 , 0.6.1
-2005-08-28 , 0.7.0
-2005-11-03 , 0.8.0
+2005-05-20,"PyPy 0.6"
+2005-05-21,"PyPy 0.6.1"
+2005-08-28,"PyPy 0.7.0"
+2005-11-03,"PyPy 0.8.0"



More information about the Pypy-commit mailing list