From 1796bbb91885d8a11837b0d50c4b2093e2314352 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 17:50:28 -0400 Subject: Perform refactoring to PEP 8 naming conventions --- archinstall/lib/hardware.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'archinstall/lib/hardware.py') diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index d1723cde..f527b5da 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -3,7 +3,7 @@ import os import subprocess from typing import Optional -from .general import sys_command +from .general import SysCommand from .networking import list_interfaces, enrich_iface_types __packages__ = [ @@ -56,48 +56,48 @@ AVAILABLE_GFX_DRIVERS = { } -def hasWifi() -> bool: +def has_wifi() -> bool: return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values() -def hasAMDCPU() -> bool: +def has_amd_cpu() -> bool: if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): return True return False -def hasIntelCPU() -> bool: +def has_intel_cpu() -> bool: if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode(): return True return False -def hasUEFI() -> bool: +def has_uefi() -> bool: return os.path.isdir('/sys/firmware/efi') -def graphicsDevices() -> dict: +def graphics_devices() -> dict: cards = {} - for line in sys_command("lspci"): + for line in SysCommand("lspci"): if b' VGA ' in line: _, identifier = line.split(b': ', 1) cards[identifier.strip().lower().decode('UTF-8')] = line return cards -def hasNvidiaGraphics() -> bool: - return any('nvidia' in x for x in graphicsDevices()) +def has_nvidia_graphics() -> bool: + return any('nvidia' in x for x in graphics_devices()) -def hasAmdGraphics() -> bool: - return any('amd' in x for x in graphicsDevices()) +def has_amd_graphics() -> bool: + return any('amd' in x for x in graphics_devices()) -def hasIntelGraphics() -> bool: - return any('intel' in x for x in graphicsDevices()) +def has_intel_graphics() -> bool: + return any('intel' in x for x in graphics_devices()) -def cpuVendor() -> Optional[str]: +def cpu_vendor() -> Optional[str]: cpu_info = json.loads(subprocess.check_output("lscpu -J", shell=True).decode('utf-8'))['lscpu'] for info in cpu_info: if info.get('field', None): @@ -106,7 +106,7 @@ def cpuVendor() -> Optional[str]: return None -def isVM() -> bool: +def is_vm() -> bool: try: subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine return True -- cgit v1.2.3-54-g00ecf