HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/serial/urlhandler/__pycache__/protocol_hwgrep.cpython-36.pyc
3

M�]W/�@sfddlZddlZyeWnek
r0eZYnXGdd�dej�Zedkrbed�Zde_e	e�dS)�Nc@s*eZdZdZejjjdd��Zdd�ZdS)�SerialzOJust inherit the native Serial port implementation and patch the port property.cCs@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$szSerial.portc
Cs,|j�jd�r|dd�}d}d}|jd�}|jd�}xv|D]n}d|krZ|jdd�\}}n|}d}|d	kr�t|�d}|dkr�td
j|���q<|dkr�d}q<td
j|���q<Wxxttj	j
j|��D]R\}	}
}|�rytj|	�}Wntj
k
r�w�Yn
X|j�|�r|d8}q�|	SWtj
dj|���dS)z(extract host and port from an URL stringz	hwgrep://�	NrF�&�=��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�sortedrZtoolsZ
list_portsZgreprZSerialException�close)
r
ZurlrZ	test_open�argsZregexp�argZoptionrrZdescZhwid�srrr
r	,s<


zSerial.from_urlN)	�__name__�
__module__�__qualname__�__doc__rrr�setterr	rrrr
r sr�__main__zhwgrep://ttyS0)
rZserial.tools.list_portsr�	NameError�strrrrr�printrrrr
�<module>s
6