From 3cb52cedb7940a67fdc780673c65ad84476eaf41 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 14 Jan 2020 09:02:37 -0500 Subject: [PATCH] Fix breakage incurred from 'style fixup' changes The pycodestyle fixes that were submitted broke a few things. One it removed the utf8 declaration for code that had utf8 in it, breaking python2. It also introduced a circular import by moving an import to unconditionally import rather than conditionally import. Fix these two issues. Change-Id: Ibfeccd5b649bd597b7f879bb6124d8bbcbc3ec69 --- pyghmi/ipmi/oem/lenovo/imm.py | 1 + pyghmi/ipmi/sdr.py | 18 +----------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index c177626a..25bd8859 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1,3 +1,4 @@ +# coding=utf8 # Copyright 2016-2019 Lenovo # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/pyghmi/ipmi/sdr.py b/pyghmi/ipmi/sdr.py index 3ffe1e00..953c13c2 100644 --- a/pyghmi/ipmi/sdr.py +++ b/pyghmi/ipmi/sdr.py @@ -1,3 +1,4 @@ +# coding=utf8 # Copyright 2014 IBM Corporation # Copyright 2015 Lenovo # @@ -33,12 +34,10 @@ import os import random import string import struct -import sys import weakref import pyghmi.constants as const import pyghmi.exceptions as exc -import pyghmi.ipmi.command as ipmicmd import pyghmi.ipmi.private.constants as ipmiconst import six @@ -813,18 +812,3 @@ class SDR(object): # This is where manufacturers can add their own # decode information return "".join(hex(x) for x in auxdata) - - -if __name__ == "__main__": # test code - password = os.environ['IPMIPASSWORD'] - bmc = sys.argv[1] - user = sys.argv[2] - ipmicmd = ipmicmd.Command(bmc=bmc, userid=user, password=password) - sdr = SDR(ipmicmd) - for number in sdr.get_sensor_numbers(): - rsp = ipmicmd.raw_command(command=0x2d, netfn=4, data=(number,)) - if 'error' in rsp: - continue - reading = sdr.sensors[number].decode_sensor_reading(rsp['data']) - if reading is not None: - print(repr(reading))