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 6, 2024
1 parent ce06ffc commit 381de17
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/turnkeyml/common/system_info.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from abc import ABC
import importlib.metadata
import platform
import subprocess
import re
import importlib.metadata
import wmi
from abc import ABC
import subprocess


class SystemInfo(ABC):
Expand Down Expand Up @@ -59,6 +58,8 @@ class WindowsSystemInfo(SystemInfo):

def __init__(self):
super().__init__()
import wmi

self.connection = wmi.WMI()

def get_processor_name(self) -> str:
Expand All @@ -70,7 +71,11 @@ def get_processor_name(self) -> str:
"""
processors = self.connection.Win32_Processor()
if processors:
return f"{processors[0].Name.strip()} ({processors[0].NumberOfCores} cores, {processors[0].NumberOfLogicalProcessors} logical processors)"
return (
f"{processors[0].Name.strip()} "
f"({processors[0].NumberOfCores} cores, "
f"{processors[0].NumberOfLogicalProcessors} logical processors)"
)
return "Processor information not found."

def get_system_model(self) -> str:
Expand Down Expand Up @@ -166,7 +171,7 @@ def get_npu_power_mode() -> str:
except FileNotFoundError:
# xrt-smi not present
pass
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
pass
return "NPU power mode not found."

Expand All @@ -181,7 +186,7 @@ def get_windows_power_setting() -> str:
try:
out = subprocess.check_output(["powercfg", "/getactivescheme"]).decode()
return re.search(r"\((.*?)\)", out).group(1)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
pass
return "Windows power setting not found"

Expand Down Expand Up @@ -219,9 +224,6 @@ def get_dict(self) -> dict:
class WSLSystemInfo(SystemInfo):
"""Class used to access system information in WSL"""

def __init__(self):
super().__init__()

@staticmethod
def get_system_model() -> str:
"""
Expand Down Expand Up @@ -261,9 +263,6 @@ def get_dict(self) -> dict:
class LinuxSystemInfo(SystemInfo):
"""Class used to access system information in Linux"""

def __init__(self):
super().__init__()

@staticmethod
def get_processor_name() -> str:
"""
Expand Down Expand Up @@ -345,9 +344,6 @@ def get_dict(self) -> dict:
class UnsupportedOSSystemInfo(SystemInfo):
"""Class used to access system information in unsupported operating systems"""

def __init__(self):
super().__init__()

def get_dict(self):
"""
Retrieves all the system information into a dictionary
Expand Down

0 comments on commit 381de17

Please sign in to comment.