🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-08-07 22:56:00 | PHP 8.2.32
📂
/ (Root)
/
usr
/
lib
/
python3.6
/
site-packages
/
serial
/
tools
/
__pycache__
📍 /usr/lib/python3.6/site-packages/serial/tools/__pycache__
🔄 Refresh
✏️
Editing: list_ports.cpython-36.opt-1.pyc
Read Only
3 M�]W � @ s~ d Z ddlZddlZddlZejdkr4ddlmZ n(ejdkrLddlmZ nedj ej���dd� Z d d � Zedkrze� dS )aA This module will provide a function called comports that returns an iterable (generator or list) that will enumerate available com ports. Note that on some systems non-existent ports may be listed. Additionally a grep function is supplied that can be used to search for ports based on their descriptions or hardware ID. � N�nt)�comports�posixz;Sorry: no implementation for your platform ('{}') availablec c sP t j| t j�}x<t� D ]2}|\}}}|j|�sB|j|�sB|j|�r|V qW dS )z� Search for ports using a regular expression. Port name, description and hardware ID are searched. The function returns an iterable that returns the same tuples as comport() would do. N)�re�compile�Ir �search)�regexp�r�info�port�desc�hwid� r � /usr/lib/python3.6/list_ports.py�grep% s r c C sJ dd l } | jdd�}|jdddd� |jdd d dd� |jd dd dd� |jdtdd� |j� }d}|jr�|js�tjj dj |j�� tt|j��}n tt � �}xxt|d�D ]j\}\}}}|jd ks�|j|k�rtjj dj |�� |j�rtjj dj |�� tjj dj |�� |d7 }q�W |j�sF|�r:tjj dj |�� ntjj d� d S )Nr zSerial port enumeration)�descriptionr �?z%only show ports that match this regex)�nargs�helpz-vz --verbose� store_truezshow more messages)�actionr z-qz--quietzsuppress all messagesz-nzonly output the N-th entry)�typer z Filtered list with regexp: {!r} � z{:20} z desc: {} z hwid: {} z{} ports found zno ports found )�argparse�ArgumentParser�add_argument�int� parse_argsr �quiet�sys�stderr�write�format�sortedr r � enumerate�n�stdout�verbose) r �parser�args�hits�iteratorr&