Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stubs no longer in typeshed #18373

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions mypy/stubinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@ def stub_distribution_name(module: str) -> str | None:
legacy_bundled_packages: dict[str, str] = {
"aiofiles": "types-aiofiles",
"bleach": "types-bleach",
"boto": "types-boto",
"cachetools": "types-cachetools",
"click_spinner": "types-click-spinner",
"contextvars": "types-contextvars",
"croniter": "types-croniter",
"dataclasses": "types-dataclasses",
"dateparser": "types-dateparser",
"dateutil": "types-python-dateutil",
"decorator": "types-decorator",
"deprecated": "types-Deprecated",
"docutils": "types-docutils",
"first": "types-first",
"gflags": "types-python-gflags",
"markdown": "types-Markdown",
"mock": "types-mock",
"OpenSSL": "types-pyOpenSSL",
Expand All @@ -56,20 +52,14 @@ def stub_distribution_name(module: str) -> str | None:
"pycurl": "types-pycurl",
"pymysql": "types-PyMySQL",
"pyrfc3339": "types-pyRFC3339",
"python2": "types-six",
"pytz": "types-pytz",
"pyVmomi": "types-pyvmomi",
"redis": "types-redis",
"requests": "types-requests",
"retry": "types-retry",
"simplejson": "types-simplejson",
"singledispatch": "types-singledispatch",
"six": "types-six",
"slugify": "types-python-slugify",
"tabulate": "types-tabulate",
"toml": "types-toml",
"typed_ast": "types-typed-ast",
"tzlocal": "types-tzlocal",
"ujson": "types-ujson",
"waitress": "types-waitress",
"yaml": "types-PyYAML",
Expand All @@ -92,7 +82,6 @@ def stub_distribution_name(module: str) -> str | None:
"atheris": "types-atheris",
"authlib": "types-Authlib",
"aws_xray_sdk": "types-aws-xray-sdk",
"babel": "types-babel",
"boltons": "types-boltons",
"braintree": "types-braintree",
"bs4": "types-beautifulsoup4",
Expand All @@ -112,23 +101,19 @@ def stub_distribution_name(module: str) -> str | None:
"cronlog": "types-python-crontab",
"crontab": "types-python-crontab",
"crontabs": "types-python-crontab",
"d3dshot": "types-D3DShot",
"datemath": "types-python-datemath",
"dateparser_data": "types-dateparser",
"dde": "types-pywin32",
"defusedxml": "types-defusedxml",
"docker": "types-docker",
"dockerfile_parse": "types-dockerfile-parse",
"docopt": "types-docopt",
"editdistance": "types-editdistance",
"entrypoints": "types-entrypoints",
"exifread": "types-ExifRead",
"fanstatic": "types-fanstatic",
"farmhash": "types-pyfarmhash",
"flake8_2020": "types-flake8-2020",
"flake8_builtins": "types-flake8-builtins",
"flake8_docstrings": "types-flake8-docstrings",
"flake8_plugin_utils": "types-flake8-plugin-utils",
"flake8_rst_docstrings": "types-flake8-rst-docstrings",
"flake8_simplify": "types-flake8-simplify",
"flake8_typing_imports": "types-flake8-typing-imports",
Expand All @@ -150,7 +135,6 @@ def stub_distribution_name(module: str) -> str | None:
"import_export": "types-django-import-export",
"influxdb_client": "types-influxdb-client",
"inifile": "types-inifile",
"invoke": "types-invoke",
"isapi": "types-pywin32",
"jack": "types-JACK-Client",
"jenkins": "types-python-jenkins",
Expand Down Expand Up @@ -189,9 +173,7 @@ def stub_distribution_name(module: str) -> str | None:
"pep8ext_naming": "types-pep8-naming",
"perfmon": "types-pywin32",
"pexpect": "types-pexpect",
"PIL": "types-Pillow",
"playhouse": "types-peewee",
"playsound": "types-playsound",
"portpicker": "types-portpicker",
"psutil": "types-psutil",
"psycopg2": "types-psycopg2",
Expand Down Expand Up @@ -230,17 +212,14 @@ def stub_distribution_name(module: str) -> str | None:
"shapely": "types-shapely",
"slumber": "types-slumber",
"sspicon": "types-pywin32",
"stdlib_list": "types-stdlib-list",
"str2bool": "types-str2bool",
"stripe": "types-stripe",
"tensorflow": "types-tensorflow",
"tgcrypto": "types-TgCrypto",
"timer": "types-pywin32",
"toposort": "types-toposort",
"tqdm": "types-tqdm",
"translationstring": "types-translationstring",
"tree_sitter_languages": "types-tree-sitter-languages",
"tree_sitter": "types-tree-sitter",
"ttkthemes": "types-ttkthemes",
"unidiff": "types-unidiff",
"untangle": "types-untangle",
Expand Down
4 changes: 2 additions & 2 deletions mypy/test/teststubinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def test_is_legacy_bundled_packages(self) -> None:
assert not is_module_from_legacy_bundled_package("foobar_asdf")
assert not is_module_from_legacy_bundled_package("PIL")
assert is_module_from_legacy_bundled_package("pycurl")
assert is_module_from_legacy_bundled_package("dataclasses")
assert is_module_from_legacy_bundled_package("dateparser")

def test_stub_distribution_name(self) -> None:
assert stub_distribution_name("foobar_asdf") is None
assert stub_distribution_name("pycurl") == "types-pycurl"
assert stub_distribution_name("babel") == "types-babel"
assert stub_distribution_name("bs4") == "types-beautifulsoup4"
assert stub_distribution_name("google.cloud.ndb") == "types-google-cloud-ndb"
assert stub_distribution_name("google.cloud.ndb.submodule") == "types-google-cloud-ndb"
assert stub_distribution_name("google.cloud.unknown") is None
Expand Down
12 changes: 6 additions & 6 deletions test-data/unit/pythoneval.test
Original file line number Diff line number Diff line change
Expand Up @@ -1507,24 +1507,24 @@ note: A user-defined top-level module with name "typing" is not supported
# flags: --ignore-missing-imports
import scribe # No Python 3 stubs available for scribe
from scribe import x
import python2 # Python 3 stubs available for python2
import pytz # Python 3 stubs available for pytz
import foobar_asdf
import jack # This has a stubs package but was never bundled with mypy, so ignoring works
[out]
_testIgnoreImportIfNoPython3StubAvailable.py:4: error: Library stubs not installed for "python2"
_testIgnoreImportIfNoPython3StubAvailable.py:4: note: Hint: "python3 -m pip install types-six"
_testIgnoreImportIfNoPython3StubAvailable.py:4: error: Library stubs not installed for "pytz"
_testIgnoreImportIfNoPython3StubAvailable.py:4: note: Hint: "python3 -m pip install types-pytz"
_testIgnoreImportIfNoPython3StubAvailable.py:4: note: (or run "mypy --install-types" to install all missing stub packages)
_testIgnoreImportIfNoPython3StubAvailable.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

[case testNoPython3StubAvailable]
import scribe
from scribe import x
import python2
import pytz
[out]
_testNoPython3StubAvailable.py:1: error: Cannot find implementation or library stub for module named "scribe"
_testNoPython3StubAvailable.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_testNoPython3StubAvailable.py:3: error: Library stubs not installed for "python2"
_testNoPython3StubAvailable.py:3: note: Hint: "python3 -m pip install types-six"
_testNoPython3StubAvailable.py:3: error: Library stubs not installed for "pytz"
_testNoPython3StubAvailable.py:3: note: Hint: "python3 -m pip install types-pytz"
_testNoPython3StubAvailable.py:3: note: (or run "mypy --install-types" to install all missing stub packages)


Expand Down
Loading