iblrig.serial_singleton.filter_ports

iblrig.serial_singleton.filter_ports(**kwargs)[source]

Filter serial ports based on specified criteria.

Parameters:

**kwargs (keyword arguments) – Filtering criteria for serial ports. Each keyword should correspond to an attribute of the serial port object (ListPortInfo). The values associated with the keywords are used to filter the ports based on various conditions.

Yields:

str – The device name of a filtered serial port that meets all specified criteria.

Parameters:

kwargs (dict[str, Any])

Return type:

Generator[str, None, None]

Examples

To filter ports by manufacturer and product:

>>> for port in filter_ports(manufacturer="Arduino", product="Uno"):
...     print(port)
Raises:

ValueError – If a specified attribute does not exist for a port.

Parameters:

kwargs (dict[str, Any])

Return type:

Generator[str, None, None]

Notes

  • The function uses regular expressions for string matching when both actual and expected values are strings.