From fa3dd656fa34acc269a8b69793009f8422ba0635 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sat, 13 Jul 2024 07:20:53 +0000 Subject: [PATCH 1/5] Add ``MimeTypes.add_types method`` --- stdlib/mimetypes.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index 517193e3516f..8eb808252e36 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -53,3 +53,4 @@ class MimeTypes: def read_windows_registry(self, strict: bool = True) -> None: ... if sys.version_info >= (3, 13): def guess_file_type(self, path: StrPath, *, strict: bool = True) -> tuple[str | None, str | None]: ... + def add_type(self, type: str, ext: str, strict: bool = True) -> None: ... From 15bfe4fbb92334bf7bd3efb5bbaf5d3939343321 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 07:24:17 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/mimetypes.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index 8eb808252e36..0184dd3f2e8f 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -53,4 +53,5 @@ class MimeTypes: def read_windows_registry(self, strict: bool = True) -> None: ... if sys.version_info >= (3, 13): def guess_file_type(self, path: StrPath, *, strict: bool = True) -> tuple[str | None, str | None]: ... + def add_type(self, type: str, ext: str, strict: bool = True) -> None: ... From c577a4a1358a44c75013c7ec38cc1f3b0049d65c Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sat, 13 Jul 2024 07:27:12 +0000 Subject: [PATCH 3/5] Remove ``MimeTypes.add_type`` from allowlist --- stdlib/@tests/stubtest_allowlists/common.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 784599491c9d..f2a6b4079bcf 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -202,7 +202,6 @@ ctypes.ARRAY ctypes.SetPointerType ctypes.c_voidp ctypes.util.test -mimetypes.MimeTypes.add_type modulefinder.test multiprocessing.managers.Server.accepter multiprocessing.managers.Server.create From dd613640ec9941f0d09acd044eb4ba8dd1543ba8 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sat, 13 Jul 2024 08:20:54 +0000 Subject: [PATCH 4/5] Move add_type between __init__ and guess_extension --- stdlib/mimetypes.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index 0184dd3f2e8f..1de0cb43fe7a 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -45,6 +45,7 @@ class MimeTypes: types_map: tuple[dict[str, str], dict[str, str]] types_map_inv: tuple[dict[str, str], dict[str, str]] def __init__(self, filenames: tuple[str, ...] = (), strict: bool = True) -> None: ... + def add_type(self, type: str, ext: str, strict: bool = True) -> None: ... def guess_extension(self, type: str, strict: bool = True) -> str | None: ... def guess_type(self, url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ... def guess_all_extensions(self, type: str, strict: bool = True) -> list[str]: ... @@ -54,4 +55,3 @@ class MimeTypes: if sys.version_info >= (3, 13): def guess_file_type(self, path: StrPath, *, strict: bool = True) -> tuple[str | None, str | None]: ... - def add_type(self, type: str, ext: str, strict: bool = True) -> None: ... From 266d956b542ddcfa74a1e7a9dfb85ff2da847d20 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sat, 13 Jul 2024 08:21:30 +0000 Subject: [PATCH 5/5] Remove newline --- stdlib/mimetypes.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index 1de0cb43fe7a..9914a34a2d6a 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -54,4 +54,3 @@ class MimeTypes: def read_windows_registry(self, strict: bool = True) -> None: ... if sys.version_info >= (3, 13): def guess_file_type(self, path: StrPath, *, strict: bool = True) -> tuple[str | None, str | None]: ... -