o
    äî‡^ñ  ã                   @   sj   d dl mZ zd dlZW n ey   d dlmZ Y nw d dlZdd„ Zedkr3e 	d¡Z
ee
ƒ dS dS )é    )Úabsolute_importNc              
   C   sä   t  | ¡}|jdkrt d |j¡¡‚d}zt  |jd¡ ¡ D ]\}}|dkr,|d }qt	d |¡ƒ‚W n t	yH } zt d |¡¡‚d	}~ww t
t|ƒsUt	d
 |¡ƒ‚tt|ƒ}t|tjƒsgt	d |¡ƒ‚d |j|jg¡|fS )z(extract host and port from an URL stringZaltzmexpected a string in the form "alt://port[?option[=value][&option[=value]]]": not starting with alt:// ({!r})ÚSerialTÚclassr   zunknown option: {!r}zRexpected a string in the form "alt://port[?option[=value][&option[=value]]]": {!r}Nzunknown class: {!r}z'class {!r} is not an instance of SerialÚ )ÚurlparseZurlsplitZschemeÚserialZSerialExceptionÚformatZparse_qsZqueryÚitemsÚ
ValueErrorÚhasattrÚgetattrÚ
issubclassr   ÚjoinZnetlocÚpath)ZurlÚpartsÚ
class_nameÚoptionÚvaluesÚeÚcls© r   ú@/usr/lib/python3/dist-packages/serial/urlhandler/protocol_alt.pyÚserial_class_for_url   s4   

þ
üþ€ÿ

r   Ú__main__z&alt:///dev/ttyS0?class=PosixPollSerial)Z
__future__r   r   ÚImportErrorZurllib.parseÚparser   r   Ú__name__Zserial_for_urlÚsÚprintr   r   r   r   Ú<module>   s   ÿ
þ