File: //lib/python3/dist-packages/serial/urlhandler/__pycache__/protocol_alt.cpython-311.pyc
�
��^� � � � d dl mZ d dlZn# e$ r d dlmZ Y nw xY wd dlZd� Zedk r ej d� � Z
ee
� � dS dS )� )�absolute_importNc �, � t j | � � }|j dk r,t j d� |j � � � � �d} t j |j d� � � � � D ]5\ }}|dk r |d }�t d� |� � � � �n9# t $ r,}t j d� |� � � � �d }~ww xY wt t |� � s"t d
� |� � � � �t t |� � }t |t j
� � s"t d� |� � � � �d� |j |j g� � |fS )
z(extract host and port from an URL string�altzmexpected 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�serial�SerialException�format�parse_qs�query�items�
ValueError�hasattr�getattr�
issubclassr �join�netloc�path)�url�parts�
class_name�option�values�e�clss �@/usr/lib/python3/dist-packages/serial/urlhandler/protocol_alt.py�serial_class_for_urlr! s� � ���c�"�"�E��|�u����$�
.�.4�f�U�\�.B�.B�D� D� D� �J� N�&�/���T�B�B�H�H�J�J� H� H�N�F�F��� � �#�A�Y�
�
� �!7�!>�!>�v�!F�!F�G�G�G� H��
� N� N� N��$�
C�CI�6�!�9�9�N� N� N�����N���� �6�:�&�&� C��.�5�5�j�A�A�B�B�B�
�&�*�
%�
%�C��c�6�=�)�)� W��B�I�I�*�U�U�V�V�V��G�G�U�\�5�:�.�/�/��5�5s �A"B2 �2
C(�<'C#�#C(�__main__z&alt:///dev/ttyS0?class=PosixPollSerial)�
__future__r r �ImportError�urllib.parse�parser r! �__name__�serial_for_url�s�print� � r �<module>r- s� ��&