From 7148ee86121ac774f775f16433fb67294dd4647c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Gr=C3=BCbel?= Date: Tue, 2 Aug 2022 23:57:39 +0200 Subject: [PATCH] Improve urllib3.util.url annotations (#8460) --- stubs/urllib3/urllib3/util/url.pyi | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/stubs/urllib3/urllib3/util/url.pyi b/stubs/urllib3/urllib3/util/url.pyi index b658bb36c..91a36abb9 100644 --- a/stubs/urllib3/urllib3/util/url.pyi +++ b/stubs/urllib3/urllib3/util/url.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import NamedTuple from .. import exceptions @@ -6,8 +6,16 @@ LocationParseError = exceptions.LocationParseError url_attrs: list[str] -class Url: - slots: Any +class _UrlBase(NamedTuple): + auth: str | None + fragment: str | None + host: str | None + path: str | None + port: str | None + query: str | None + scheme: str | None + +class Url(_UrlBase): def __new__( cls, scheme: str | None = ..., @@ -27,6 +35,6 @@ class Url: @property def url(self) -> str: ... -def split_first(s, delims): ... +def split_first(s: str, delims: str) -> tuple[str, str, str | None]: ... def parse_url(url: str) -> Url: ... -def get_host(url): ... +def get_host(url: str) -> tuple[str, str | None, str | None]: ...