Browse Source

Fix the easier code smells

Alois Mahdal 7 years ago
parent
commit
619a6824e0
1 changed files with 8 additions and 9 deletions
  1. 8
    9
      sznqalibs/hoover.py

+ 8
- 9
sznqalibs/hoover.py View File

@@ -77,7 +77,6 @@ def regression_test(argsrc, tests, driver_settings, cleanup_hack=None,
77 77
                 aclass.check_values(argset)
78 78
             except NotImplementedError:         # let them bail out
79 79
                 counter.count_for(aclass, 'bailouts')
80
-                pass
81 80
             else:
82 81
                 data[aclass], duration, overhead = get_data_and_stats(
83 82
                     aclass, argset, driver_settings)
@@ -156,7 +155,7 @@ def get_data(driverClass, argset, driver_settings):
156 155
 # ## The Pattern                                                           ## #
157 156
 # ########################################################################### #
158 157
 
159
-class _BaseRuleOp():
158
+class _BaseRuleOp(object):
160 159
 
161 160
     def __init__(self, items, item_ok):
162 161
         self._items = items
@@ -175,7 +174,7 @@ class _BaseRuleOp():
175 174
             raise ValueError("items must be an iterable: %r" % self._items)
176 175
 
177 176
 
178
-class RuleOp():
177
+class RuleOp(object):
179 178
 
180 179
     class ALL(_BaseRuleOp):
181 180
 
@@ -218,7 +217,7 @@ class RuleOp():
218 217
 # ## The Path                                                              ## #
219 218
 # ########################################################################### #
220 219
 
221
-class DictPath():
220
+class DictPath(object):
222 221
     """Mixin that adds "path-like" behavior to the top dict of dicts.
223 222
 
224 223
     Use this class as a mixin for a deep dic-like structure and you can access
@@ -245,7 +244,7 @@ class DictPath():
245 244
 
246 245
     DIV = "/"
247 246
 
248
-    class Path():
247
+    class Path(object):
249 248
 
250 249
         def __init__(self, path, div):
251 250
             self.DIV = div
@@ -476,14 +475,14 @@ class TinyCase(dict, DictPath):
476 475
     def hack(self, ruleset):
477 476
         """Apply action from each rule, if patterns match."""
478 477
 
479
-        def driver_matches():
478
+        def driver_matches(rule):
480 479
             if 'drivers' not in rule:
481 480
                 return True
482 481
             else:
483 482
                 return any(dataMatch(p, self)
484 483
                            for p in rule['drivers'])
485 484
 
486
-        def argset_matches():
485
+        def argset_matches(rule):
487 486
             if 'argsets' not in rule:
488 487
                 return True
489 488
             else:
@@ -493,7 +492,7 @@ class TinyCase(dict, DictPath):
493 492
         matched = False
494 493
         cls = self.__class__
495 494
         for rule in ruleset:
496
-            if driver_matches() and argset_matches():
495
+            if driver_matches(rule) and argset_matches(rule):
497 496
                 matched = True
498 497
                 for action_name in cls.known_actions:
499 498
                     if action_name in rule:
@@ -999,7 +998,7 @@ class Tracker(dict):
999 998
 
1000 999
         def get_all_colnames():
1001 1000
             cn = {}
1002
-            for errstr, affected in self._db.iteritems():
1001
+            for affected in self._db.itervalues():
1003 1002
                 for argset in affected:
1004 1003
                     cn.update(dict.fromkeys(argset.keys()))
1005 1004
                 return sorted(cn.keys())