From fbdc8319f86a3e308f70d54cf399cf1e8ff80951 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Thu, 30 Mar 2023 14:41:35 +0100 Subject: [PATCH] Improve `urlunsplit` and `urlunparse` --- stdlib/urllib/parse.pyi | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 8e179ca765b1..116754091d1a 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -196,14 +196,15 @@ else: url: bytes | bytearray | None, scheme: bytes | bytearray | None | Literal[""] = "", allow_fragments: bool = True ) -> SplitResultBytes: ... +# Requires an iterable of length 6 @overload -def urlunparse( - components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None] -) -> AnyStr: ... +def urlunparse(components: Iterable[None]) -> Literal[b""]: ... @overload -def urlunparse(components: Sequence[AnyStr | None]) -> AnyStr: ... +def urlunparse(components: Iterable[AnyStr | None]) -> AnyStr: ... + +# Requires an iterable of length 5 @overload -def urlunsplit(components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]) -> AnyStr: ... +def urlunsplit(components: Iterable[None]) -> Literal[b""]: ... @overload -def urlunsplit(components: Sequence[AnyStr | None]) -> AnyStr: ... +def urlunsplit(components: Iterable[AnyStr | None]) -> AnyStr: ... def unwrap(url: str) -> str: ...