
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
3
M]W                 @   sZ   yd dl Z W n ek
r*   d dljZ Y nX d dlZdd ZedkrVejdZe	e dS )    Nc             C   s   t j| }|jdkr&tjdj|jd}yDx>t j|jdj D ](\}}|dkrZ|d }q@t	dj|q@W W n2 t	k
r } ztjdj|W Y d	d	}~X nX t
t|st	d
j|tt|}t|tjst	dj|dj|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urlsplitschemeserialZSerialExceptionformatZparse_qsZqueryitems
ValueErrorhasattrgetattr
issubclassr   joinZnetlocpath)Zurlparts
class_nameZoptionvaluesecls r   "/usr/lib/python3.6/protocol_alt.pyserial_class_for_url   s*    





r   __main__z&alt:///dev/ttyS0?class=PosixPollSerial)
r   ImportErrorZurllib.parseparser   r   __name__Zserial_for_urlsprintr   r   r   r   <module>   s   
