[Piuparts-commits] [piuparts] 09/12: p-r: cope with increasing number of states

Holger Levsen holger at layer-acht.org
Mon Mar 13 12:39:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit a08080de049b6e80707dfa72d93cb0e0d4a95aab
Author: Andreas Beckmann <anbe at debian.org>
Date:   Wed Mar 8 07:47:55 2017 +0100

    p-r: cope with increasing number of states
    
    and lines with varying number of columns in counts.txt
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog   | 1 +
 piuparts-report.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7b554bc..8dfaeed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ piuparts (0.77) UNRELEASED; urgency=medium
   * piuparts-analyze.py:
   * piuparts-report.py:
     - Plot all states in the graphs.
+    - Support new states in plots (varying number of columns in counts.txt).
 
  -- Andreas Beckmann <anbe at debian.org>  Sun, 12 Mar 2017 23:30:21 +0100
 
diff --git a/piuparts-report.py b/piuparts-report.py
index 3169bb9..17970d9 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -1234,8 +1234,8 @@ class Section:
         active_states = self._binary_db.get_active_states()
         r('nstate = %d' % len(states))
         r('snames = c(%s)' % ','.join(['"%s"' % s if s in active_states else '"(%s)"' % s for s in states]))
-        r('t <- (read.table("' + countsfile + '",sep=",",header=1,row.names=1))')
-        r('cname <- c("date",rep(colnames(t)))')
+        r('cnames = c("date",snames)')
+        r('t <- (read.table("' + countsfile + '",sep=",",header=0,skip=1,col.names=cnames,row.names=1,fill=TRUE))')
         # here we define how many days we wants stats for (163=half a year)
         # r('v <- t[(nrow(t)-163):nrow(t),0:nstate]')
         # make graph since day 1

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list