Skip to content

Commit

Permalink
Fix LGTM alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jostar Yang committed Jun 30, 2021
1 parent 3335a3b commit 87aa7cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ class Chassis(PddfChassis):
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
self.__initialize_components()

for index in range(NUM_COMPONENT):
component = Component(index)
self._component_list.append(component)



def __initialize_components(self):
from sonic_platform.component import Component
for index in range(NUM_COMPONENT):
Expand All @@ -41,8 +36,7 @@ def __initialize_components(self):
sfp_change_event_data = {'valid': 0, 'last': 0, 'present': 0}
def get_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
port = 0
port_dict = {}
change_dict = {}
change_dict['sfp'] = port_dict

Expand Down Expand Up @@ -76,9 +70,6 @@ def get_change_event(self, timeout=2000):
return True, change_dict
else:
return True, change_dict

print("get_change_event: Control should not reach here")
return False, change_dict

def get_sfp(self, index):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ def get_firmware_version(self):
Returns:
string: The firmware versions of the module
"""
cpld_version = None
fw_version = None
if self.name == "BIOS":
fw_version = self.__get_bios_version()
elif "CPLD" in self.name:
cmd = "i2cget -f -y {0} {1} 0x1".format(self.cpld_mapping[self.index][0], self.cpld_mapping[self.index][1])
status, value = subprocess.getstatusoutput(cmd)
if not status:
cpld_version = value.rstrip()
fw_version = value.rstrip()

return cpld_version
return fw_version

def install_firmware(self, image_path):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
VERSION = '1.0'
FUNCTION_NAME = '/usr/local/bin/accton_as4630_54pe_pddf_monitor'

global log_file
global log_level




# Temperature Policy
Expand Down Expand Up @@ -159,7 +159,7 @@ def manage_fans(self):
LEVEL_TEMP_CRITICAL: [100, 16, 240000, 300000],
}
temp = [0, 0, 0]
temp_fail = 0

#thermal = ThermalUtil()
#fan = FanUtil()
# Supposedly all the fans are set with same duty cycle
Expand All @@ -169,8 +169,8 @@ def manage_fans(self):
if test_temp == 0:
for i in range(0, 3):
temp[i] = platform_chassis.get_thermal(i).get_temperature()
if temp[i] == 0.0 or temp[i] == None:
temp_fail = 1
if temp[i] == 0.0 or temp[i] is None:

logging.warning("Get temp-%d fail", i)
return False
temp[i] = int(temp[i]*1000)
Expand All @@ -190,7 +190,7 @@ def manage_fans(self):

temp_val = 0
for i in range(0, 3):
if temp[i] == None:
if temp[i] is None:
break
temp_val += temp[i]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env python
# Script to stop and start the respective platforms default services.
# This will be used while switching the pddf->non-pddf mode and vice versa
import os
import sys

import commands

def check_pddf_support():
Expand Down

0 comments on commit 87aa7cd

Please sign in to comment.