dbfdg 3 M]Wf @sddlZddlZddlTdZeZejdkr8ddlmZnhddlZej dkrXddl mZnHej dkrxddl mZm Z m Z n(ej d krddlmZned jej d gZd d ZdS)N)*z3.1.1Zcli)Serialntposix)rPosixPollSerial VTIMESerialjavaz;Sorry: no implementation for your platform ('{}') availablezserial.urlhandlerc Os|jdd }t}y |j}Wntk r2YnXd|kr|jddd}dj|}xntD]X}ytj|tj||} Wnt k rw\Yq\Xt | dr| j |\}}n| j}Pq\Wt dj||d ||} || _ |r| j| S) a Get an instance of the Serial class, depending on port/url. The port is not opened when the keyword parameter 'do_not_open' is true, by default it is. All other parameters are directly passed to the __init__ method when the port is instantiated. The list of package names that is searched for protocol handlers is kept in ``protocol_handler_packages``. e.g. we want to support a URL ``foobar://``. A module ``my_handlers.protocol_foobar`` is provided by the user. Then ``protocol_handler_packages.append("my_handlers")`` would extend the search path so that ``serial_for_url("foobar://"))`` would work. Z do_not_openFz://rz .protocol_{}serial_class_for_urlz$invalid URL, protocol {!r} not knownN)N)poprlowerAttributeErrorsplitformatprotocol_handler_packages importlib import_module ImportErrorhasattrr ValueErrorZportopen) ZurlargskwargsZdo_openklassZ url_lowercaseZprotocolZ module_nameZ package_nameZhandler_moduleinstancer/usr/lib/python3.6/__init__.pyserial_for_url)s2     r)rsysZserial.serialutil __version__VERSIONplatformZserial.serialclirosnameZserial.serialwin32Zserial.serialposixrrZserial.serialjavarrrrrrrr s