parameters: (self, proxy)
return_statement: return scheme, user, password, hostport
docstring: Return (scheme, user, password, host/port) given a URL or an authority.
  
      If a URL is supplied, it must have an authority (host:port) component.
      According to RFC 3986, having an authority component means the URL must
      have two slashes after the scheme:
  
      >>> _parse_proxy('file:/ftp.example.com/')
      Traceback (most recent call last):
      ValueError: proxy URL with no authority: 'file:/ftp.example.com/'
  
      The first three items of the returned tuple may be None.
  
      Examples of authority parsing:
  
      >>> _parse_proxy('proxy.example.com')
      (None, None, None, 'proxy.example.com')
      >>> _parse_proxy('proxy.example.com:3128')
      (None, None, None, 'proxy.example.com:3128')
  
      The authority component may optionally include userinfo (assumed to be
      username:password):
  
      >>> _parse_proxy('joe:password@proxy.example.com')
      (None, 'joe', 'password', 'proxy.example.com')
      >>> _parse_proxy('joe:password@proxy.example.com:3128')
      (None, 'joe', 'password', 'proxy.example.com:3128')
  
      Same examples, but with URLs instead:
  
      >>> _parse_proxy('http://proxy.example.com/')
      ('http', None, None, 'proxy.example.com')
      >>> _parse_proxy('http://proxy.example.com:3128/')
      ('http', None, None, 'proxy.example.com:3128')
      >>> _parse_proxy('http://joe:password@proxy.example.com/')
      ('http', 'joe', 'password', 'proxy.example.com')
      >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
      ('http', 'joe', 'password', 'proxy.example.com:3128')
  
      Everything after the authority is ignored:
  
      >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
      ('ftp', 'joe', 'password', 'proxy.example.com')
  
      Test for no trailing '/' case:
  
      >>> _parse_proxy('http://joe:password@proxy.example.com')
      ('http', 'joe', 'password', 'proxy.example.com')
docstring_summary: Return (scheme, user, password, host/port) given a URL or an authority.
docstring_tokens: Return ( scheme user password host / port ) given a URL or an authority .
function: def _parse_proxy(self, proxy):
      """Return (scheme, user, password, host/port) given a URL or an authority.
  
      If a URL is supplied, it must have an authority (host:port) component.
      According to RFC 3986, having an authority component means the URL must
      have two slashes after the scheme:
  
      >>> _parse_proxy('file:/ftp.example.com/')
      Traceback (most recent call last):
      ValueError: proxy URL with no authority: 'file:/ftp.example.com/'
  
      The first three items of the returned tuple may be None.
  
      Examples of authority parsing:
  
      >>> _parse_proxy('proxy.example.com')
      (None, None, None, 'proxy.example.com')
      >>> _parse_proxy('proxy.example.com:3128')
      (None, None, None, 'proxy.example.com:3128')
  
      The authority component may optionally include userinfo (assumed to be
      username:password):
  
      >>> _parse_proxy('joe:password@proxy.example.com')
      (None, 'joe', 'password', 'proxy.example.com')
      >>> _parse_proxy('joe:password@proxy.example.com:3128')
      (None, 'joe', 'password', 'proxy.example.com:3128')
  
      Same examples, but with URLs instead:
  
      >>> _parse_proxy('http://proxy.example.com/')
      ('http', None, None, 'proxy.example.com')
      >>> _parse_proxy('http://proxy.example.com:3128/')
      ('http', None, None, 'proxy.example.com:3128')
      >>> _parse_proxy('http://joe:password@proxy.example.com/')
      ('http', 'joe', 'password', 'proxy.example.com')
      >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
      ('http', 'joe', 'password', 'proxy.example.com:3128')
  
      Everything after the authority is ignored:
  
      >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
      ('ftp', 'joe', 'password', 'proxy.example.com')
  
      Test for no trailing '/' case:
  
      >>> _parse_proxy('http://joe:password@proxy.example.com')
      ('http', 'joe', 'password', 'proxy.example.com')
  
      """
      scheme, r_scheme = splittype(proxy)
      if not r_scheme.startswith("/"):
        # authority
        scheme = None
        authority = proxy
      else:
        # URL
        if not r_scheme.startswith("//"):
          raise ValueError("proxy URL with no authority: %r" % proxy)
        # We have an authority, so for RFC 3986-compliant URLs (by ss 3.
        # and 3.3.), path is empty or starts with '/'
        end = r_scheme.find("/", 2)
        if end == -1:
          end = None
        authority = r_scheme[2:end]
      userinfo, hostport = splituser(authority)
      if userinfo is not None:
        user, password = splitpasswd(userinfo)
      else:
        user = password = None
      return scheme, user, password, hostport
function_tokens: def _parse_proxy ( self , proxy ) : scheme , r_scheme = splittype ( proxy ) if not r_scheme . startswith ( "/" ) : # authority scheme = None authority = proxy else : # URL if not r_scheme . startswith ( "//" ) : raise ValueError ( "proxy URL with no authority: %r" % proxy ) # We have an authority, so for RFC 3986-compliant URLs (by ss 3. # and 3.3.), path is empty or starts with '/' end = r_scheme . find ( "/" , 2 ) if end == - 1 : end = None authority = r_scheme [ 2 : end ] userinfo , hostport = splituser ( authority ) if userinfo is not None : user , password = splitpasswd ( userinfo ) else : user = password = None return scheme , user , password , hostport