fix static analysis CI

old-commit-hash: 2d79ccb9ad245aae2cc835b07da5cfb9971715e1
This commit is contained in:
Adeeb Shihadeh
2021-03-09 17:49:15 -08:00
parent 57292073e1
commit d26e419122

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
import os
import sys
import time
@@ -7,7 +6,6 @@ def average(avg, sample):
# Weighted avg between existing value and new sample
return ((avg[0] * avg[1] + sample) / (avg[1] + 1), avg[1] + 1)
if __name__ == '__main__':
sample_time = None
@@ -16,9 +14,9 @@ if __name__ == '__main__':
start_time = time.monotonic()
try:
voltage_average = (0., 0) # average, count
current_average = (0., 0)
power_average = (0., 0)
voltage_average = (0, 0) # average, count
current_average = (0, 0)
power_average = (0, 0)
while sample_time is None or time.monotonic() - start_time < sample_time:
with open("/sys/bus/i2c/devices/0-0040/hwmon/hwmon1/in1_input") as f:
voltage = int(f.read()) / 1000.