net
net
¶
Small URL helpers — host formatting, authority normalisation.
git_remote_host(url)
¶
The host a git remote points at, or None when it names a local path.
Covers both forms git accepts: scheme URLs (https://, ssh://),
and the scp-like git@github.com:org/repo shorthand — which carries no
scheme, so urlsplit reads it hostless and would silently drop the
host. The result is lower-cased, since every caller compares it.
Source code in src/terok/lib/util/net.py
url_host(host)
¶
host formatted for an HTTP URL authority.
IPv6 literals are wrapped in square brackets so ::1 becomes
[::1]; IPv4 addresses and hostnames pass through unchanged.
Already-bracketed input is left alone to avoid double-wrapping.