power_status: Fix pylint warnings/errors
Errors:
* Hook script "./utils/run_pylint.py" failed with code 4:
Using config file /usr/local/google/home/campello/chromiumos/src/third_party/autotest/files/utils/pylintrc
************* Module power_status
W:147,16: Specify string format arguments as logging function parameters (logging-not-lazy)
W:470,12: Specify string format arguments as logging function parameters (logging-not-lazy)
W:945,20: Specify string format arguments as logging function parameters (logging-not-lazy)
------------------------------------------------------------------
Your code has been rated at 9.98/10 (previous run: 9.98/10, +0.00)
BUG=None
TEST=None
Change-Id: Ie9e47309ec1164e25aaa39212606985c97b47c51
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1947583
Reviewed-by: Derek Beckett <dbeckett@chromium.org>
Tested-by: Daniel Campello <campello@chromium.org>
Commit-Queue: Daniel Campello <campello@chromium.org>
diff --git a/client/cros/power/power_status.py b/client/cros/power/power_status.py
index 3591a79..9dbfddc 100644
--- a/client/cros/power/power_status.py
+++ b/client/cros/power/power_status.py
@@ -143,9 +143,8 @@
if field.find('trip_point_') != -1 and field.find('_temp') != -1 \
and self.temp > self.read_val(field, int):
self.num_points_tripped += 1
- logging.info('Temperature trip point #' + \
- field[len('trip_point_'):field.rfind('_temp')] + \
- ' tripped.')
+ logging.info('Temperature trip point #%s tripped.', \
+ field[len('trip_point_'):field.rfind('_temp')])
class ThermalStatHwmon(DevStat):
@@ -466,7 +465,7 @@
temp_str = self.thermal.get_temps()
if temp_str:
- logging.info('Temperature reading: ' + temp_str)
+ logging.info('Temperature reading: %s', temp_str)
else:
logging.error('Could not read temperature, skipping.')
@@ -879,8 +878,8 @@
# Kernel race condition that can happen while a new C-state
# gets added (e.g. AC->battery). Don't know the 'name' of
# the state yet, but its 'time' would be 0 anyway.
- logging.warning('Read name: <null>, time: %d from %s'
- % (usecs, state) + '... skipping.')
+ logging.warning('Read name: <null>, time: %d from %s...'
+ 'skipping.', usecs, state)
continue
cpuidle_stats[name] += usecs