MOON
Server: Apache
System: Linux server.royaltuning.hu 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Tue Feb 21 04:20:52 EST 2023 x86_64
User: royaltuning (1001)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
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