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