Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_format.py28 linesDownload Raw Back to mdurl
1from __future__ import annotations2 3from typing import TYPE_CHECKING4 5if TYPE_CHECKING:6    from mdurl._url import URL7 8 9def format(url: URL) -> str:  # noqa: A00110    result = ""11 12    result += url.protocol or ""13    result += "//" if url.slashes else ""14    result += url.auth + "@" if url.auth else ""15 16    if url.hostname and ":" in url.hostname:17        # ipv6 address18        result += "[" + url.hostname + "]"19    else:20        result += url.hostname or ""21 22    result += ":" + url.port if url.port else ""23    result += url.pathname or ""24    result += url.search or ""25    result += url.hash or ""26 27    return result28 
codekingpro/portable-devtools · Team Ai