Move from i++ to enumerate()

This commit is contained in:
Mykola Grymalyuk
2021-11-15 12:30:28 -07:00
parent 3ad2c538be
commit 936febe2e4
2 changed files with 2 additions and 6 deletions

View File

@@ -677,8 +677,7 @@ set million colour before rebooting"""
non_metal_os = os_data.os_data.high_sierra
else:
non_metal_os = os_data.os_data.catalina
i = 0
for gpu in gpus:
for i, gpu in enumerate(gpus):
if gpu.class_code and gpu.class_code != 0xFFFFFFFF:
print(f"- Found GPU ({i}): {utilities.friendly_hex(gpu.vendor_id)}:{utilities.friendly_hex(gpu.device_id)}")
if gpu.arch in [device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Fermi]:
@@ -716,7 +715,6 @@ set million colour before rebooting"""
if self.constants.detected_os > os_data.os_data.big_sur:
self.ivy_gpu = True
self.supports_metal = True
i += 1
if self.supports_metal is True:
# Avoid patching Metal and non-Metal GPUs if both present, prioritize Metal GPU
# Main concerns are for iMac12,x with Sandy iGPU and Kepler dGPU

View File

@@ -105,11 +105,9 @@ def csr_decode(os_sip):
raw = c_uint(0)
errmsg = libsys.csr_get_active_config(byref(raw))
sip_int = raw.value
i = 0
for current_sip_bit in sip_data.system_integrity_protection.csr_values:
for i, current_sip_bit in enumerate(sip_data.system_integrity_protection.csr_values):
if sip_int & (1 << i):
sip_data.system_integrity_protection.csr_values[current_sip_bit] = True
i = i + 1
# Can be adjusted to whatever OS needs patching
sip_needs_change = all(sip_data.system_integrity_protection.csr_values[i] for i in os_sip)