D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
lib
/
python3.6
/
site-packages
/
serial
/
urlhandler
/
__pycache__
/
Filename :
protocol_hwgrep.cpython-36.pyc
back
Copy
3 M�]W/ � @ sf d dl Z d dlZ ye W n ek r0 eZY nX G dd� de j�Zedkrbed�Zde_e e� dS )� Nc @ s* e Zd ZdZejjjdd� �Zdd� ZdS )�SerialzOJust inherit the native Serial port implementation and patch the port property.c C s@ t |t�r,|jd�r,tjjj| | j|�� ntjjj| |� dS )z%translate port name before storing itz hwgrep://N)� isinstance� basestring� startswith�serialr �port�__set__�from_url)�self�value� r �%/usr/lib/python3.6/protocol_hwgrep.pyr $ s zSerial.portc C s, |j � jd�r|dd� }d}d}|jd�}|jd�}xv|D ]n}d|krZ|jdd�\}}n|}d}|d kr�t|�d }|dk r�td j|���q<|dkr�d}q<td j|���q<W xxttj j j|��D ]R\} } }|�rytj| �}W n tj k r� w�Y n X |j� |�r|d8 }q�| S W tj dj|���dS )z(extract host and port from an URL stringz hwgrep://� Nr F�&�=� �nz9option "n" expects a positive integer larger than 1: {!r}Z skip_busyTzunknown option: {!r}z#no ports found matching regexp {!r})�lowerr �split�pop�int� ValueError�format�sortedr ZtoolsZ list_portsZgrepr ZSerialException�close) r Zurlr Z test_open�argsZregexp�argZoptionr r ZdescZhwid�sr r r r , s<