im going to bed -=-
This commit is contained in:
2026-02-12 02:28:23 +02:00
parent 0b92f6f239
commit a5d75e6bac
1972 changed files with 308880 additions and 0 deletions

27
lib/mdurl/_format.py Normal file
View File

@@ -0,0 +1,27 @@
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mdurl._url import URL
def format(url: URL) -> str: # noqa: A001
result = ""
result += url.protocol or ""
result += "//" if url.slashes else ""
result += url.auth + "@" if url.auth else ""
if url.hostname and ":" in url.hostname:
# ipv6 address
result += "[" + url.hostname + "]"
else:
result += url.hostname or ""
result += ":" + url.port if url.port else ""
result += url.pathname or ""
result += url.search or ""
result += url.hash or ""
return result