Improve urllib3.util.url annotations (#8460)

This commit is contained in:
Anton Grübel
2022-08-02 23:57:39 +02:00
committed by GitHub
parent 93ebd58055
commit 7148ee8612

View File

@@ -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]: ...