Browse Source

Convert to Python 3: `reduce()` -> `functools.reduce()`

Alois Mahdal 2 years ago
parent
commit
956ed002a5
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      sznqalibs/hoover.py

+ 10
- 3
sznqalibs/hoover.py View File

1
 # coding=utf-8
1
 # coding=utf-8
2
 
2
 
3
 import collections
3
 import collections
4
+import functools
4
 import csv
5
 import csv
5
 import difflib
6
 import difflib
6
 import hashlib
7
 import hashlib
58
     tracker = Tracker()
59
     tracker = Tracker()
59
     last_argset = None
60
     last_argset = None
60
 
61
 
61
-    all_classes = set(reduce(lambda a, b: a+b,
62
-                             [triple[1:] for triple in tests]))
62
+    all_classes = set(functools.reduce(
63
+        lambda a, b: a+b,
64
+        [triple[1:] for triple in tests]
65
+    ))
63
 
66
 
64
     counter = StatCounter()
67
     counter = StatCounter()
65
 
68
 
955
         """
958
         """
956
 
959
 
957
         def total_errors():
960
         def total_errors():
958
-            return reduce(lambda x, y: x + len(y), self._db.values(), 0)
961
+            return functools.reduce(
962
+                lambda x, y: x + len(y),
963
+                self._db.values(),
964
+                initial=0,
965
+            )
959
 
966
 
960
         stats = {
967
         stats = {
961
             "argsets": self.argsets_done,
968
             "argsets": self.argsets_done,