parameters: (self, url)
docstring: extract host and port from an URL string
docstring_summary: extract host and port from an URL string
docstring_tokens: extract host and port from an URL string
function: def from_url(self, url):
          """extract host and port from an URL string"""
          parts = urlparse.urlsplit(url)
          if parts.scheme != "loop":
              raise SerialException(
                  'expected a string in the form '
                  '"loop://[?logging={debug|info|warning|error}]": not starting '
                  'with loop:// ({!r})'.format(parts.scheme))
          try:
              # process options now, directly altering self
              for option, values in urlparse.parse_qs(parts.query, True).items():
                  if option == 'logging':
                      logging.basicConfig()   # XXX is that good to call it here?
                      self.logger = logging.getLogger('pySerial.loop')
                      self.logger.setLevel(LOGGER_LEVELS[values[0]])
                      self.logger.debug('enabled logging')
                  else:
                      raise ValueError('unknown option: {!r}'.format(option))
          except ValueError as e:
              raise SerialException(
                  'expected a string in the form '
                  '"loop://[?logging={debug|info|warning|error}]": {}'.format(e))
function_tokens: def from_url ( self , url ) : parts = urlparse . urlsplit ( url ) if parts . scheme != "loop" : raise SerialException ( 'expected a string in the form ' '"loop://[?logging={debug|info|warning|error}]": not starting ' 'with loop:// ({!r})' . format ( parts . scheme ) ) try : # process options now, directly altering self for option , values in urlparse . parse_qs ( parts . query , True ) . items ( ) : if option == 'logging' : logging . basicConfig ( ) # XXX is that good to call it here? self . logger = logging . getLogger ( 'pySerial.loop' ) self . logger . setLevel ( LOGGER_LEVELS [ values [ 0 ] ] ) self . logger . debug ( 'enabled logging' ) else : raise ValueError ( 'unknown option: {!r}' . format ( option ) ) except ValueError as e : raise SerialException ( 'expected a string in the form ' '"loop://[?logging={debug|info|warning|error}]": {}' . format ( e ) )