From 966be3918397305452cb84c22332a3e378686780 Mon Sep 17 00:00:00 2001 From: Stephen Thompson Date: Thu, 6 Jun 2024 09:14:50 +0100 Subject: [PATCH] Simplify ports to probe logic from lint consider-using-max-builtin (#85) --- sksurgerynditracker/nditracker.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sksurgerynditracker/nditracker.py b/sksurgerynditracker/nditracker.py index 286a433..176aa06 100644 --- a/sksurgerynditracker/nditracker.py +++ b/sksurgerynditracker/nditracker.py @@ -61,8 +61,7 @@ def _get_serial_port_name(configuration): serial_ports = list_ports.comports() result = None name = None - if ports_to_probe > len(serial_ports): - ports_to_probe = len(serial_ports) + ports_to_probe = min(ports_to_probe, len(serial_ports)) if serial_port is None: for port_no in range(ports_to_probe):