Skip to content

Commit

Permalink
Fixed lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: amd-pworfolk <[email protected]>
  • Loading branch information
amd-pworfolk committed Dec 4, 2024
1 parent 645660c commit 952f772
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/turnkeyml/common/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import logging
import sys
import shutil
import traceback
import platform
import subprocess
Expand Down Expand Up @@ -293,8 +292,8 @@ def get_windows_driver_version(device_name: str) -> str:
"powershell " + cmd, capture_output=True, text=True, check=True
).stdout
return output.split("\n")[3].split()[-1]
except Exception as e: # pylint: disable=broad-except
return None
except Exception: # pylint: disable=broad-except
return ""


def get_system_info():
Expand All @@ -319,28 +318,33 @@ def get_cim_info(command):
if os_type == "Windows":

processor = get_cim_info(
"Get-CimInstance -ClassName Win32_Processor | %{ '{0}###({1} cores, {2} logical processors)' "
"Get-CimInstance -ClassName Win32_Processor | "
"%{ '{0}###({1} cores, {2} logical processors)' "
"-f $_.Name,$_.NumberOfCores,$_.NumberOfLogicalProcessors }"
)
info_dict["Processor"] = " ".join(
[str.strip() for str in processor.split("###")]
)

info_dict["OEM System"] = get_cim_info(
"Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty Model"
"Get-CimInstance -ClassName Win32_ComputerSystem | "
"Select-Object -ExpandProperty Model"
)

memory = get_cim_info(
"Get-CimInstance -ClassName Win32_PhysicalMemory | %{ '{0} {1} GB {2} ns' -f $_.Manufacturer,($_.Capacity/1gb),$_.Speed }"
"Get-CimInstance -ClassName Win32_PhysicalMemory | "
"%{ '{0} {1} GB {2} ns' -f $_.Manufacturer,($_.Capacity/1gb),$_.Speed }"
)
info_dict["Physical Memory"] = " + ".join(memory.split("\n"))

info_dict["BIOS Version"] = get_cim_info(
"Get-CimInstance -ClassName Win32_BIOS | Select-Object -ExpandProperty SMBIOSBIOSVersion"
"Get-CimInstance -ClassName Win32_BIOS | "
"Select-Object -ExpandProperty SMBIOSBIOSVersion"
)

info_dict["CPU Max Clock"] = get_cim_info(
"Get-CimInstance -ClassName Win32_Processor | Select-Object -ExpandProperty MaxClockSpeed"
"Get-CimInstance -ClassName Win32_Processor | "
"Select-Object -ExpandProperty MaxClockSpeed"
)
info_dict["CPU Max Clock"] += " MHz"

Expand All @@ -353,7 +357,7 @@ def get_cim_info(command):
for device_name in device_names:
driver_version = get_windows_driver_version(device_name)
driver_versions[device_name] = (
driver_version if driver_version is not None else "DRIVER NOT FOUND"
driver_version if len(driver_version) else "DRIVER NOT FOUND"
)
info_dict["Driver Versions"] = driver_versions

Expand Down

0 comments on commit 952f772

Please sign in to comment.