Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

réduction de la complexité algorithmique #107

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions patches/calamares-nixos-extensions/modules/nixos/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,13 @@ def get_vga_devices():
keywords = [' VGA compatible controller: ', ' 3D controller: ']
for line in lines:
for k in keywords:
if k in line:
address, description = line.split(k, 1)
pci_address = convert_to_pci_format(address)
if pci_address != "":
vga_devices.append((pci_address, description))
break
if k not in line:
continue
address, description = line.split(k, 1)
pci_address = convert_to_pci_format(address)
if pci_address != "":
vga_devices.append((pci_address, description))
break
return vga_devices


Expand All @@ -248,12 +249,13 @@ def has_nvidia_laptop(vga_devices):
dev_desc = description.lower()
keywords = ['laptop', 'mobile']
pattern = r'\b\d{3}M\b' # three digits followed by 'M'
if "nvidia" in dev_desc:
for k in keywords:
if k in dev_desc:
return True
if re.search(pattern, description):
if "nvidia" not in dev_desc:
continue
for k in keywords:
if k in dev_desc:
return True
if re.search(pattern, description):
return True
return False

def generate_prime_entries(vga_devices):
Expand Down