[tor-commits] [sbws/master] Reorder methods in BWV3File

juga at torproject.org juga at torproject.org
Tue Sep 18 09:26:11 UTC 2018


commit 9ac61cc56cad551af3c7e1194ef94183520e4e86
Author: juga0 <juga at riseup.net>
Date:   Wed Aug 29 14:46:34 2018 +0000

    Reorder methods in BWV3File
    
    1. magic methods
    2. classmethods
    3. staticmethods
    4. properties
    5. methods
---
 sbws/lib/v3bwfile.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index 9324bde..b068075 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -374,6 +374,16 @@ class V3BWFile(object):
         return str(self.header) + ''.join([str(bw_line)
                                            for bw_line in self.bw_lines])
 
+    @classmethod
+    def from_arg_results(cls, args, conf, results):
+        bw_lines = [V3BWLine.from_results(results[fp]) for fp in results]
+        bw_lines = sorted(bw_lines, key=lambda d: d.bw, reverse=True)
+        if args.scale:
+            bw_lines = scale_lines(bw_lines, args.scale_constant)
+        header = V3BWHeader.from_results(conf, results)
+        f = cls(header, bw_lines)
+        return f
+
     @property
     def total_bw(self):
         return total_bw(self.bw_lines)
@@ -386,16 +396,6 @@ class V3BWFile(object):
     def avg_bw(self):
         return self.total_bw / self.num_lines
 
-    @classmethod
-    def from_arg_results(cls, args, conf, results):
-        bw_lines = [V3BWLine.from_results(results[fp]) for fp in results]
-        bw_lines = sorted(bw_lines, key=lambda d: d.bw, reverse=True)
-        if args.scale:
-            bw_lines = scale_lines(bw_lines, args.scale_constant)
-        header = V3BWHeader.from_results(conf, results)
-        f = cls(header, bw_lines)
-        return f
-
     def write(self, output):
         if output == '/dev/stdout':
             log.info("Writing to stdout is not supported.")





More information about the tor-commits mailing list