Browse Source

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

Alois Mahdal 1 year ago
parent
commit
510b3417bf
3 changed files with 15 additions and 15 deletions
  1. 2
    2
      sznqalibs/bottleneck.py
  2. 10
    10
      sznqalibs/hoover.py
  3. 3
    3
      tests/test_hoover.py

+ 2
- 2
sznqalibs/bottleneck.py View File

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

+ 10
- 10
sznqalibs/hoover.py View File

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

+ 3
- 3
tests/test_hoover.py View File

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