Minor code refactors

This commit is contained in:
Eric Torres 2018-11-09 20:07:06 -08:00
parent b1d73da2bf
commit 618ddd1c98

View File

@ -29,12 +29,13 @@ def retrieve_smart_temp(device_node):
:param device_node: device to retrieve temperature for :param device_node: device to retrieve temperature for
:type device_node: str :type device_node: str
:returns: output of skdump in mKelvin :returns: output of skdump in mKelvin
:rtype: str :rtype: float
""" """
dump_cmd = subprocess.run(['sudo', 'skdump', '--temperature', dump_cmd = subprocess.run(['sudo', 'skdump', '--temperature',
device_node], capture_output=True, device_node],
capture_output=True,
text=True) text=True)
return dump_cmd.stdout return float(dump_cmd.stdout)
def convert_to_celsius(mkel_temp): def convert_to_celsius(mkel_temp):
@ -44,7 +45,7 @@ def convert_to_celsius(mkel_temp):
:returns: temperature converted into degrees celsius :returns: temperature converted into degrees celsius
:rtype: str :rtype: str
""" """
return (float(mkel_temp)/1000) - 273.15 return (mkel_temp/1000) - 273.15
if __name__ == '__main__': if __name__ == '__main__':