Skip to content

Commit e9ccf16

Browse files
committed
fix for flake8
1 parent e411507 commit e9ccf16

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

defs/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import re
21
import os
2+
import re
33

4-
import serial.tools.list_ports
4+
from serial.tools import list_ports
55

66

77
def strtobool (val):
@@ -52,7 +52,7 @@ def get_usb_serial_port_info(port : str = "") -> str:
5252
if os.path.islink(port):
5353
port = os.path.realpath(port)
5454

55-
for p in serial.tools.list_ports.comports():
55+
for p in list_ports.comports(): #from serial.tools
5656
if str(p.device).upper() == port.upper():
5757
vid = hex(p.vid) if p.vid is not None else ""
5858
pid = hex(p.pid) if p.pid is not None else ""
@@ -80,7 +80,7 @@ def find_usb_serial_port(port : str = "", vendor_id : str = "", product_id : st
8080
serial_number = match.group("serial") if match.group("serial") else ""
8181
location = match.group("location") if match.group("location") else ""
8282

83-
for port in serial.tools.list_ports.comports():
83+
for port in list_ports.comports(): #from serial.tools
8484
if ((not vendor_id or port.vid == vendor_id) and
8585
( not product_id or port.pid == product_id) and
8686
( not serial_number or port.serial_number == serial_number) and

0 commit comments

Comments
 (0)