python / cpython

The Python programming language
https://www.python.org
Other
61.75k stars 29.68k forks source link

MimeTypes.add_type() is missing from the docs #121658

Open steverep opened 1 month ago

steverep commented 1 month ago

Bug report

Bug description:

from mimetypes import MimeTypes

m = MimeTypes()
m.add_type # type checking error

The add_type method is not defined on the class interface, and also not defined in the RST file for the docs.

CPython versions tested on:

3.8, 3.9, 3.10, 3.11, 3.12, 3.13, CPython main branch

Operating systems tested on:

Linux, macOS, Windows

Linked PRs

tomasr8 commented 1 month ago

Seems like the add_type method is missing from typeshed: https://github.com/python/typeshed/blob/6a9b53e719a139c2d6b41cf265ed0990cf438192/stdlib/mimetypes.pyi#L42

Eclips4 commented 1 month ago

Hello! Thanks for the report. As @tomasr8 said, type checking error is coming from the fact that Mimetypes.add_type isn't defined in the typeshed stubs. Actually, yes, we need to update our docs to add this method. Would you like to send a pull request?

Eclips4 commented 1 month ago

FYI, here's the PR for typeshed: https://github.com/python/typeshed/pull/12329

stinovlas commented 1 month ago

I'm working on this during EuroPython 2024 sprint.

stinovlas commented 1 month ago

I'm working on this during EuroPython 2024 sprint.

Fixed in #121665.

RafaelJohn9 commented 7 hours ago

@Eclips4 has this issue been fixed? if not I would like to be assignedd

Eclips4 commented 6 hours ago

@Eclips4 has this issue been fixed? if not I would like to be assignedd

There's an existing PR which solves the issue: #121665. We're just waiting for someone with ability to merge it.

RafaelJohn9 commented 6 hours ago

Aah nice 👍🙂