MCPcopy
hub / github.com/tornadoweb/tornado / split_host_and_port

Function split_host_and_port

tornado/httputil.py:1305–1319  ·  view source on GitHub ↗

Returns ``(host, port)`` tuple from ``netloc``. Returned ``port`` will be ``None`` if not present. .. versionadded:: 4.1

(netloc: str)

Source from the content-addressed store, hash-verified

1303
1304
1305def split_host_and_port(netloc: str) -> Tuple[str, Optional[int]]:
1306 """Returns ``(host, port)`` tuple from ``netloc``.
1307
1308 Returned ``port`` will be ``None`` if not present.
1309
1310 .. versionadded:: 4.1
1311 """
1312 match = _netloc_re.match(netloc)
1313 if match:
1314 host = match.group(1)
1315 port = int(match.group(2)) # type: Optional[int]
1316 else:
1317 host = netloc
1318 port = None
1319 return (host, port)
1320
1321
1322def qs_to_qsl(qs: Dict[str, List[AnyStr]]) -> Iterable[Tuple[str, AnyStr]]:

Callers 1

__init__Method · 0.85

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected