From 06af4a8d881e3f66a9f6534b7810efd619644388 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 28 Dec 2021 13:34:49 +0300 Subject: [PATCH] mimetypes.guess_type() accepts PathLikes in 3.8+ (#6716) --- stdlib/mimetypes.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index eefd5439e..8f51c1580 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -28,7 +28,10 @@ class MimeTypes: types_map_inv: tuple[dict[str, str], dict[str, str]] def __init__(self, filenames: tuple[str, ...] = ..., strict: bool = ...) -> None: ... def guess_extension(self, type: str, strict: bool = ...) -> str | None: ... - def guess_type(self, url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... + if sys.version_info >= (3, 8): + def guess_type(self, url: StrPath, strict: bool = ...) -> tuple[str | None, str | None]: ... + else: + def guess_type(self, url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... def guess_all_extensions(self, type: str, strict: bool = ...) -> list[str]: ... def read(self, filename: str, strict: bool = ...) -> None: ... def readfp(self, fp: IO[str], strict: bool = ...) -> None: ...