stop using dict iter* helpers
Change from iter{keys,items,values}() to {keys,items,values}().
Python 3 doesn't offer the iter variants, and we don't really have
any cases where performance is critical where we'd need to avoid
creating the temporary list (which is what Python 2 does).
This is mostly mechanical.
BUG=chromium:980619
TEST=lint is unchanged in chromite
TEST=unittests pass
Change-Id: I591110f2eb5d43bb9268b975b14bd7ade66a4e35
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1689014
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
diff --git a/scripts/sysmon/puppet_metrics.py b/scripts/sysmon/puppet_metrics.py
index 81b0ffd..47614c0 100644
--- a/scripts/sysmon/puppet_metrics.py
+++ b/scripts/sysmon/puppet_metrics.py
@@ -81,7 +81,7 @@
"""Return mapping of resources information."""
resources = self._data.get('resources', {})
total = resources.pop('total', 0)
- resources['other'] = max(0, total - sum(resources.itervalues()))
+ resources['other'] = max(0, total - sum(resources.values()))
return resources
@property
@@ -90,7 +90,7 @@
times = self._data.get('time', {}).copy()
times.pop('last_run', None)
total = times.pop('total', 0)
- times['other'] = max(0, total - sum(times.itervalues()))
+ times['other'] = max(0, total - sum(times.values()))
return times
@property
@@ -111,13 +111,13 @@
_config_version_metric.set(summary.config_version)
_puppet_version_metric.set(str(summary.puppet_version))
- for key, value in summary.events.iteritems():
+ for key, value in summary.events.items():
_events_metric.set(value, {'result': key})
- for key, value in summary.resources.iteritems():
+ for key, value in summary.resources.items():
_resources_metric.set(value, {'action': key})
- for key, value in summary.times.iteritems():
+ for key, value in summary.times.items():
_times_metric.set(value, {'step': key})
if summary.last_run_time is not None: