Kaynağa Gözat

Convert to Python 3: `dict.iteritems()` -> `dict.items()`

Alois Mahdal 2 yıl önce
ebeveyn
işleme
db594fe84d
1 değiştirilmiş dosya ile 7 ekleme ve 7 silme
  1. 7
    7
      sznqalibs/hoover.py

+ 7
- 7
sznqalibs/hoover.py Dosyayı Görüntüle

@@ -390,7 +390,7 @@ class TinyCase(dict, DictPath):
390 390
         value is a list of paths.  For each key, it goes through the
391 391
         paths and if the value equals `a` it is set to `b`.
392 392
         """
393
-        for (oldv, newv), paths in action.iteritems():
393
+        for (oldv, newv), paths in action.items():
394 394
             for path in paths:
395 395
                 try:
396 396
                     curv = self.getpath(path)
@@ -411,7 +411,7 @@ class TinyCase(dict, DictPath):
411 411
         before comparison, since direct comparison of floats is unreliable
412 412
         on some architectures.
413 413
         """
414
-        for fmt, paths in action.iteritems():
414
+        for fmt, paths in action.items():
415 415
             for path in paths:
416 416
                 if self.ispath(path):
417 417
                     new = fmt % self.getpath(path)
@@ -460,7 +460,7 @@ class TinyCase(dict, DictPath):
460 460
         Expects dict with precision (ndigits, after the dot) as a key and
461 461
         list of paths as value.
462 462
         """
463
-        for ndigits, paths in action.iteritems():
463
+        for ndigits, paths in action.items():
464 464
             for path in paths:
465 465
                 try:
466 466
                     f = self.getpath(path)
@@ -795,7 +795,7 @@ class StatCounter(object):
795 795
 
796 796
     def _computed_stats(self):
797 797
         computed = dict.fromkeys(self.formulas.keys())
798
-        for fname, fml in self.formulas.iteritems():
798
+        for fname, fml in self.formulas.items():
799 799
             try:
800 800
                 v = fml(self.generic_stats, self.driver_stats)
801 801
             except ZeroDivisionError:
@@ -835,8 +835,8 @@ class StatCounter(object):
835 835
     def all_stats(self):
836 836
         """Compute stats from formulas and add them to colledted data."""
837 837
         stats = self.generic_stats
838
-        for dname, dstats in self.driver_stats.iteritems():
839
-            for key, value in dstats.iteritems():
838
+        for dname, dstats in self.driver_stats.items():
839
+            for key, value in dstats.items():
840 840
                 stats[dname + "_" + key] = value
841 841
         stats.update(self._computed_stats())
842 842
         return stats
@@ -1046,7 +1046,7 @@ def dataMatch(pattern, data, rmax=10, _r=0):
1046 1046
         assert all([hasattr(o, 'iteritems') for o in [pattern, data]])
1047 1047
         results = []
1048 1048
         try:
1049
-            for pk, pv in pattern.iteritems():
1049
+            for pk, pv in pattern.items():
1050 1050
                 results.append(dataMatch(pv, data[pk], _r=_r+1))
1051 1051
         except KeyError:
1052 1052
             results.append(False)