From 9e79b17f40e6a94e0794e74574339fbd5a86b45d Mon Sep 17 00:00:00 2001 From: abrand Date: Wed, 14 Aug 2024 13:52:15 -0400 Subject: [PATCH] rename variables and methods using camelcase for consistency with historical code --- rqd/rqd/rqmachine.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/rqd/rqd/rqmachine.py b/rqd/rqd/rqmachine.py index 76ef58bde..88ee6c904 100644 --- a/rqd/rqd/rqmachine.py +++ b/rqd/rqd/rqmachine.py @@ -631,7 +631,7 @@ def __initMachineStats(self, pathCpuInfo=None): hyperthreadingMultiplier = 1 if platform.system() == 'Windows': - logicalCoreCount, __numProcs, hyperthreadingMultiplier = self.__init_stats_from_windows() + logicalCoreCount, __numProcs, hyperthreadingMultiplier = self.__initStatsFromWindows() __totalCores = logicalCoreCount * rqd.rqconstants.CORE_VALUE # All other systems will just have one proc/core @@ -662,7 +662,7 @@ def __initMachineStats(self, pathCpuInfo=None): if hyperthreadingMultiplier >= 1: self.__renderHost.attributes['hyperthreadingMultiplier'] = str(hyperthreadingMultiplier) - def __init_stats_from_windows(self): + def __initStatsFromWindows(self): """Init machine stats for Windows platforms. @rtype: tuple @@ -681,7 +681,7 @@ def __init_stats_from_windows(self): self.__renderHost.total_swap = int(stat.ullTotalPageFile / 1024) # Windows CPU information - self.__update_procs_mappings_from_windows() + self.__updateProcsMappingsFromWindows() logical_core_count = psutil.cpu_count(logical=True) actual_core_count = psutil.cpu_count(logical=False) @@ -691,7 +691,7 @@ def __init_stats_from_windows(self): return logical_core_count, physical_processor_count, hyper_threading_multiplier - def __update_procs_mappings_from_windows(self): + def __updateProcsMappingsFromWindows(self): """Update `__procs_by_physid_and_coreid` and `__physid_and_coreid_by_proc` mappings for Windows platforms. Implementation detail. @@ -703,24 +703,24 @@ def __update_procs_mappings_from_windows(self): self.__physid_and_coreid_by_proc = {} # Connect to the Windows Management Instrumentation (WMI) interface - wmi_instance = wmi.WMI() + wmiInstance = wmi.WMI() # Retrieve CPU information using WMI - for physical_id, processor in enumerate(wmi_instance.Win32_Processor()): + for physicalId, processor in enumerate(wmiInstance.Win32_Processor()): - thread_per_core = processor.NumberOfLogicalProcessors // processor.NumberOfCores - proc_id = 0 + threadPerCore = processor.NumberOfLogicalProcessors // processor.NumberOfCores + procId = 0 for core_id in range(processor.NumberOfCores): - for _ in range(thread_per_core): + for _ in range(threadPerCore): self.__procs_by_physid_and_coreid.setdefault( - str(physical_id), {} - ).setdefault(str(core_id), set()).add(str(proc_id)) - self.__physid_and_coreid_by_proc[str(proc_id)] = ( - str(physical_id), + str(physicalId), {} + ).setdefault(str(core_id), set()).add(str(procId)) + self.__physid_and_coreid_by_proc[str(procId)] = ( + str(physicalId), str(core_id), ) - proc_id += 1 + procId += 1 def getWindowsMemory(self): """Gets information on system memory, Windows compatible version."""