Просмотр исходного кода

Convert to Python 3: no need to inherita `object` explicitly

Alois Mahdal 2 лет назад
Родитель
Сommit
510b3417bf
3 измененных файлов: 15 добавлений и 15 удалений
  1. 2
    2
      sznqalibs/bottleneck.py
  2. 10
    10
      sznqalibs/hoover.py
  3. 3
    3
      tests/test_hoover.py

+ 2
- 2
sznqalibs/bottleneck.py Просмотреть файл

@@ -1,7 +1,7 @@
1 1
 import time
2 2
 
3 3
 
4
-class FrameState(object):
4
+class FrameState:
5 5
     """Abstraction and tracking of frame state"""
6 6
 
7 7
     def __init__(self, max_load, size, debug):
@@ -52,7 +52,7 @@ class FrameState(object):
52 52
         return self.allows
53 53
 
54 54
 
55
-class Throttle(object):
55
+class Throttle:
56 56
     """Throttle to allow only certain amount of iteration per given time.
57 57
 
58 58
     Usage:

+ 10
- 10
sznqalibs/hoover.py Просмотреть файл

@@ -158,7 +158,7 @@ def get_data(driverClass, argset, driver_settings):
158 158
 # ## The Pattern                                                           ## #
159 159
 # ########################################################################### #
160 160
 
161
-class _BaseRuleOp(object):
161
+class _BaseRuleOp:
162 162
 
163 163
     def __init__(self, items, item_ok):
164 164
         self._items = items
@@ -177,7 +177,7 @@ class _BaseRuleOp(object):
177 177
             raise ValueError("items must be an iterable: %r" % self._items)
178 178
 
179 179
 
180
-class RuleOp(object):
180
+class RuleOp:
181 181
 
182 182
     class ALL(_BaseRuleOp):
183 183
 
@@ -220,7 +220,7 @@ class RuleOp(object):
220 220
 # ## The Path                                                              ## #
221 221
 # ########################################################################### #
222 222
 
223
-class DictPath(object):
223
+class DictPath:
224 224
     """Mixin that adds "path-like" behavior to the top dict of dicts.
225 225
 
226 226
     Use this class as a mixin for a deep dic-like structure and you can access
@@ -247,7 +247,7 @@ class DictPath(object):
247 247
 
248 248
     DIV = "/"
249 249
 
250
-    class Path(object):
250
+    class Path:
251 251
 
252 252
         def __init__(self, path, div):
253 253
             self.DIV = div
@@ -551,7 +551,7 @@ class DriverDataError(Exception):
551 551
         return result
552 552
 
553 553
 
554
-class BaseTestDriver(object):
554
+class BaseTestDriver:
555 555
     """Base class for test drivers used by `hoover.regression_test` and others.
556 556
 
557 557
     This class is used to create a test driver, which is an abstraction
@@ -732,7 +732,7 @@ class MockDriverTrue(BaseTestDriver):
732 732
 # ## Helpers                                                               ## #
733 733
 # ########################################################################### #
734 734
 
735
-class StatCounter(object):
735
+class StatCounter:
736 736
     """A simple counter with formulas support."""
737 737
 
738 738
     def __init__(self):
@@ -1147,7 +1147,7 @@ def jsDiff(dira, dirb, namea="A", nameb="B", chara="a", charb="b"):
1147 1147
         def is_hdr_B(line):
1148 1148
             return line.startswith("+++")
1149 1149
 
1150
-        class Level(object):
1150
+        class Level:
1151 1151
 
1152 1152
             def __init__(self, hint):
1153 1153
                 self.hint = hint
@@ -1161,7 +1161,7 @@ def jsDiff(dira, dirb, namea="A", nameb="B", chara="a", charb="b"):
1161 1161
                     self.hinted = True
1162 1162
                     return self.hint
1163 1163
 
1164
-        class ContextTracker(object):
1164
+        class ContextTracker:
1165 1165
 
1166 1166
             def __init__(self):
1167 1167
                 self.trace = []
@@ -1234,7 +1234,7 @@ def jsDiff(dira, dirb, namea="A", nameb="B", chara="a", charb="b"):
1234 1234
     return "\n".join(compress([line for line in udiff]))
1235 1235
 
1236 1236
 
1237
-class Cartman(object):
1237
+class Cartman:
1238 1238
     """Create argument sets from ranges (or ay iterators) of values.
1239 1239
 
1240 1240
     This class is to enable easy definition and generation of dictionary
@@ -1322,7 +1322,7 @@ class Cartman(object):
1322 1322
     # TODO: implement getstats and fmtstats
1323 1323
     # TODO: N-wise
1324 1324
 
1325
-    class _BaseMark(object):
1325
+    class _BaseMark:
1326 1326
         pass
1327 1327
 
1328 1328
     class Scalar(_BaseMark):

+ 3
- 3
tests/test_hoover.py Просмотреть файл

@@ -371,7 +371,7 @@ class CartmanTest(unittest.TestCase):
371 371
 
372 372
     def test_withCustomIterator_TypeA(self):
373 373
 
374
-        class ITER_A(object):
374
+        class ITER_A:
375 375
 
376 376
             def __init__(self, items):
377 377
                 self.items = items
@@ -438,7 +438,7 @@ class CartmanTest(unittest.TestCase):
438 438
 
439 439
     def test_withCustomIterator_TypeB(self):
440 440
 
441
-        class ITER_B(object):
441
+        class ITER_B:
442 442
 
443 443
             def __init__(self, items):
444 444
                 self.items = items
@@ -610,7 +610,7 @@ class RuleOpTest(unittest.TestCase):
610 610
     # error handling
611 611
 
612 612
     def testBadOpClass(self):
613
-        class bad_op(object):
613
+        class bad_op:
614 614
             def _match(self):
615 615
                 return True
616 616
         fn = lambda: hoover.RuleOp.Match(((bad_op, [])), bool)