Rev 16: Change the average values to be displayed with a single decimal precision. in http://bazaar.launchpad.net/%7Ebzr/bzr-repodetails/trunk

John Arbash Meinel john at arbash-meinel.com
Wed Dec 24 17:49:40 GMT 2008


At http://bazaar.launchpad.net/%7Ebzr/bzr-repodetails/trunk

------------------------------------------------------------
revno: 16
revision-id: john at arbash-meinel.com-20081224174909-ub02riq9tgkb0xts
parent: john at arbash-meinel.com-20081210001735-o41l1pk7yr7ay0gf
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Wed 2008-12-24 11:49:09 -0600
message:
  Change the average values to be displayed with a single decimal precision.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2008-11-19 20:55:29 +0000
+++ b/__init__.py	2008-12-24 17:49:09 +0000
@@ -62,11 +62,11 @@
 
         if stats.inventories.extra_counters:
             self.outf.write('\nExtra Info:           ' # Padding
-                            'count    total  avg stddev  min  max\n')
+                            'count    total    avg stddev  min  max\n')
         for counter_name in sorted(stats.inventories.extra_counters):
             (count, total, avg, stddev, min_val,
              max_val) = stats.inventories.compute_extra_stats(counter_name)
-            self.outf.write("%-20s %6d %8d %4.0f %6.1f %4d %4d\n"
+            self.outf.write("%-20s %6d %8d %6.1f %6.1f %4d %4d\n"
                             % (counter_name, count, total, avg, stddev,
                                min_val, max_val))
 

=== modified file 'gather_stats.py'
--- a/gather_stats.py	2008-12-10 00:17:35 +0000
+++ b/gather_stats.py	2008-12-24 17:49:09 +0000
@@ -124,7 +124,7 @@
         """Compute average and standard deviation."""
         if count == 0:
             return 0.0, 0.0
-        avg = total / count
+        avg = float(total) / count
         # See http://en.wikipedia.org/wiki/Standard_deviation
         # Arguably, we should be using "count-1" rather than count, depending
         # on whether you consider this a full population, or just a sample

=== modified file 'tests/test_repositorydetails.py'
--- a/tests/test_repositorydetails.py	2008-12-03 00:11:01 +0000
+++ b/tests/test_repositorydetails.py	2008-12-24 17:49:09 +0000
@@ -78,11 +78,11 @@
             "Signatures:         0 KiB   0%         0 KiB   0%        0\n"
             "Total:              0 KiB 100%         0 KiB 100%        5\n"
             "\n"
-            "Extra Info:           count    total  avg stddev  min  max\n"
-            "inv depth                 1        1    1    0.0    1    1\n"
-            "leaf node items           1        2    2    0.0    2    2\n"
-            "leaf p_id items           1        2    2    0.0    2    2\n"
-            "p_id depth                1        1    1    0.0    1    1\n"
+            "Extra Info:           count    total    avg stddev  min  max\n"
+            "inv depth                 1        1    1.0    0.0    1    1\n"
+            "leaf node items           1        2    2.0    0.0    2    2\n"
+            "leaf p_id items           1        2    2.0    0.0    2    2\n"
+            "p_id depth                1        1    1.0    0.0    1    1\n"
             , out)
         self.assertEqual("", err)
 



More information about the bazaar-commits mailing list