|
Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /usr/local/lib/python3.6/site-packages/serial/urlhandler/__pycache__/ |
Upload File : |
3
F�Kd� � @ sf d dl mZ yd dlZW n ek
r6 d dljZY nX d dlZdd� Zedkrbej d�Z
ee
� dS )� )�absolute_importNc C s� t j| �}|jdkr&tjdj|j���d}yDx>t j|jd�j� D ](\}}|dkrZ|d }q@t dj|���q@W W n2 t k
r� } ztjdj|���W Y d d }~X nX t
t|�s�t d
j|���tt|�}t|tj
�s�t dj|���dj|j|jg�|fS )
z(extract host and port from an URL stringZaltzmexpected a string in the form "alt://port[?option[=value][&option[=value]]]": not starting with alt:// ({!r})�SerialT�classr zunknown option: {!r}zRexpected a string in the form "alt://port[?option[=value][&option[=value]]]": {!r}Nzunknown class: {!r}z'class {!r} is not an instance of Serial� )�urlparse�urlsplit�scheme�serialZSerialException�format�parse_qs�query�items�
ValueError�hasattr�getattr�
issubclassr �join�netloc�path)�url�parts�
class_name�option�values�e�cls� r �B/tmp/pip-build-8nxjc3nm/pyserial/serial/urlhandler/protocol_alt.py�serial_class_for_url s*
r �__main__z&alt:///dev/ttyS0?class=PosixPollSerial)�
__future__r r �ImportError�urllib.parse�parser r �__name__Zserial_for_url�s�printr r r r �<module> s