MCPcopy Create free account
hub / github.com/RustPython/RustPython / _get_hostport

Method _get_hostport

Lib/http/client.py:946–964  ·  view source on GitHub ↗
(self, host, port)

Source from the content-addressed store, hash-verified

944 encoded_host, self._tunnel_port)
945
946 def _get_hostport(self, host, port):
947 if port is None:
948 i = host.rfind(':')
949 j = host.rfind(']') # ipv6 addresses have [...]
950 if i > j:
951 try:
952 port = int(host[i+1:])
953 except ValueError:
954 if host[i+1:] == "": # http://foo.com:/ == http://foo.com/
955 port = self.default_port
956 else:
957 raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
958 host = host[:i]
959 else:
960 port = self.default_port
961 if host and host[0] == '[' and host[-1] == ']':
962 host = host[1:-1]
963
964 return (host, port)
965
966 def set_debuglevel(self, level):
967 self.debuglevel = level

Callers 2

__init__Method · 0.95
set_tunnelMethod · 0.95

Calls 2

InvalidURLClass · 0.85
rfindMethod · 0.45

Tested by

no test coverage detected