Conversation
Source commit: python/typeshed@fbb89f9
|
Diff from mypy_primer, showing the effect of this PR on open source code: pydantic (https://github.com/samuelcolvin/pydantic.git)
+ pydantic/class_validators.py:57: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/class_validators.py:84: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/class_validators.py:100: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/class_validators.py:107: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/class_validators.py:113: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/class_validators.py:125: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/class_validators.py:135: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/class_validators.py:328: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/tools.py:34: error: Unused "type: ignore" comment
+ pydantic/main.py:869: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/main.py:882: error: Missing type parameters for generic type "classmethod" [type-arg]
+ pydantic/main.py:894: error: Missing type parameters for generic type "classmethod" [type-arg]
core (https://github.com/home-assistant/core.git)
+ homeassistant/components/http/forwarded.py:91: error: Unused "type: ignore" comment
+ homeassistant/auth/mfa_modules/__init__.py:136: error: Unused "type: ignore" comment
+ homeassistant/auth/mfa_modules/__init__.py:171: error: Unused "type: ignore" comment
+ homeassistant/auth/providers/__init__.py:145: error: Unused "type: ignore" comment
+ homeassistant/auth/providers/__init__.py:178: error: Unused "type: ignore" comment
+ homeassistant/config.py:648: error: Unused "type: ignore" comment
+ homeassistant/config.py:651: error: Unused "type: ignore" comment
+ homeassistant/config.py:662: error: Unused "type: ignore" comment
+ homeassistant/config.py:672: error: Unused "type: ignore" comment
+ homeassistant/config.py:673: error: Unused "type: ignore" comment
+ homeassistant/config.py:753: error: Unused "type: ignore" comment
+ homeassistant/config.py:895: error: Unused "type: ignore" comment
+ homeassistant/setup.py:241: error: Unused "type: ignore" comment
+ homeassistant/setup.py:246: error: Unused "type: ignore" comment
+ homeassistant/helpers/check_config.py:161: error: Unused "type: ignore" comment
+ homeassistant/config_entries.py:310: error: Unused "type: ignore" comment
+ homeassistant/config_entries.py:449: error: Unused "type: ignore" comment
+ homeassistant/config_entries.py:488: error: Unused "type: ignore" comment
+ homeassistant/config_entries.py:525: error: Unused "type: ignore" comment
+ homeassistant/helpers/condition.py:929: error: Unused "type: ignore" comment
+ homeassistant/helpers/condition.py:977: error: Unused "type: ignore" comment
+ homeassistant/helpers/script.py:260: error: Unused "type: ignore" comment
+ homeassistant/helpers/script.py:262: error: Unused "type: ignore" comment
+ homeassistant/helpers/script.py:269: error: Unused "type: ignore" comment
+ homeassistant/scripts/__init__.py:67: error: Unused "type: ignore" comment
+ homeassistant/helpers/reload.py:81: error: Unused "type: ignore" comment
+ homeassistant/helpers/reload.py:82: error: Unused "type: ignore" comment
+ homeassistant/components/device_tracker/legacy.py:241: error: Unused "type: ignore" comment
+ homeassistant/components/device_tracker/legacy.py:246: error: Unused "type: ignore" comment
+ homeassistant/components/device_tracker/legacy.py:251: error: Unused "type: ignore" comment
+ homeassistant/components/device_tracker/legacy.py:256: error: Unused "type: ignore" comment
+ homeassistant/components/notify/legacy.py:61: error: Unused "type: ignore" comment
+ homeassistant/components/notify/legacy.py:66: error: Unused "type: ignore" comment
pip (https://github.com/pypa/pip.git)
- src/pip/_internal/locations/__init__.py:68: error: Module has no attribute "platlibdir"
+ src/pip/_internal/network/session.py:106: error: Unused "type: ignore" comment
+ src/pip/_internal/commands/debug.py:70: error: Value of type variable "AnyStr" of "dirname" cannot be "Optional[str]"
+ src/pip/_internal/commands/debug.py:70: error: List item 0 has incompatible type "Optional[str]"; expected "str"
streamlit (https://github.com/streamlit/streamlit.git)
+ lib/streamlit/script_runner.py:432: error: Unused "type: ignore" comment
+ lib/streamlit/script_runner.py:439: error: Unused "type: ignore" comment
werkzeug (https://github.com/pallets/werkzeug.git)
+ src/werkzeug/_reloader.py:20: error: Unused "type: ignore" comment
- tests/test_wrappers.py:833: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:856: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ tests/test_wrappers.py:833: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
ibis (https://github.com/ibis-project/ibis.git)
+ ibis/backends/tests/base.py:82: error: Argument 1 to "Path" has incompatible type "Union[str, None, Any]"; expected "Union[str, PathLike[str]]"
- ibis/backends/tests/conftest.py:45: error: Module has no attribute "TestConf"
aiohttp (https://github.com/aio-libs/aiohttp.git)
+ aiohttp/helpers.py:808: error: Unused "type: ignore" comment
+ aiohttp/multipart.py:518: error: Returning Any from function declared to return "str" [no-any-return]
+ aiohttp/multipart.py:692: error: Returning Any from function declared to return "str" [no-any-return]
+ aiohttp/connector.py:919: error: Returning Any from function declared to return "Optional[SSLContext]" [no-any-return]
+ aiohttp/connector.py:925: error: Returning Any from function declared to return "Optional[SSLContext]" [no-any-return]
+ aiohttp/connector.py:926: error: Returning Any from function declared to return "Optional[SSLContext]" [no-any-return]
+ aiohttp/connector.py:1306: error: Unused "type: ignore" comment
+ aiohttp/client_reqrep.py:1010: error: Returning Any from function declared to return "str" [no-any-return]
+ aiohttp/web_runner.py:181: error: Unused "type: ignore" comment
+ aiohttp/pytest_plugin.py:244: error: Unused "type: ignore" comment
sphinx (https://github.com/sphinx-doc/sphinx.git)
+ sphinx/util/typing.py:228: error: Unused "type: ignore" comment
+ sphinx/util/typing.py:428: error: Unused "type: ignore" comment
+ sphinx/util/inspect.py: note: In function "unwrap_all":
+ sphinx/util/inspect.py:137:19: error: Item "FunctionType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType]" has no attribute "__wrapped__"
+ sphinx/util/inspect.py:137:19: error: Item "MethodType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType]" has no attribute "__wrapped__"
+ sphinx/util/inspect.py:137:19: error: Item "BuiltinFunctionType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType]" has no attribute "__wrapped__"
+ sphinx/util/inspect.py:433: error: Unused "type: ignore" comment
+ sphinx/util/inspect.py:436: error: Unused "type: ignore" comment
+ sphinx/util/inspect.py:439: error: Unused "type: ignore" comment
+ sphinx/util/docutils.py:52: error: Unused "type: ignore" comment
+ sphinx/util/docutils.py:53: error: Unused "type: ignore" comment
+ sphinx/util/docutils.py:67: error: Unused "type: ignore" comment
+ sphinx/util/docutils.py:81: error: Unused "type: ignore" comment
+ sphinx/util/docutils.py:95: error: Unused "type: ignore" comment
+ sphinx/util/docutils.py:110: error: Unused "type: ignore" comment
+ sphinx/environment/__init__.py:624: error: Unused "type: ignore" comment
+ sphinx/domains/python.py:1452: error: Unused "type: ignore" comment
+ sphinx/writers/manpage.py:110: error: Unused "type: ignore" comment
+ sphinx/testing/util.py:126: error: Unused "type: ignore" comment
+ sphinx/testing/util.py:127: error: Unused "type: ignore" comment
+ sphinx/util/compat.py:29: error: Unused "type: ignore" comment
arviz (https://github.com/arviz-devs/arviz.git)
+ arviz/data/io_pymc3_3x.py:47: error: Unused "type: ignore" comment
+ arviz/data/io_pymc3_3x.py:48: error: Unused "type: ignore" comment
- examples/bokeh/bokeh_plot_compare.py:15: error: Call to untyped function "plot_compare" in typed context
- examples/bokeh/bokeh_plot_bpv_tstat.py:9: error: Call to untyped function "load_arviz_data" in typed context
- examples/bokeh/bokeh_plot_bpv_tstat.py:10: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ examples/bokeh/bokeh_plot_compare.py:15: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
python-chess (https://github.com/niklasf/python-chess.git)
+ chess/engine.py:122: error: Unused "type: ignore" comment
+ chess/engine.py:123: error: Unused "type: ignore" comment
+ chess/engine.py:1209: error: Unused "type: ignore" comment
pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/core/dtypes/cast.py:498: error: Unused "type: ignore" comment
isort (https://github.com/pycqa/isort.git)
+ isort/_future/__init__.py:9: error: Unused "type: ignore" comment
+ isort/_future/__init__.py:10: error: Unused "type: ignore" comment
+ isort/place.py:17: error: Returning Any from function declared to return "str"
+ isort/output.py:504: error: Unused "type: ignore" comment
+ isort/output.py:516: error: Unused "type: ignore" comment
+ isort/output.py:523: error: Unused "type: ignore" comment
pylint (https://github.com/pycqa/pylint.git)
+ pylint/checkers/utils.py:326: error: Unused "type: ignore" comment
+ pylint/checkers/utils.py:326: error: Module has no attribute "__iter__" (not iterable) [attr-defined]
rich (https://github.com/willmcgugan/rich.git)
+ rich/traceback.py:249: error: Value of type variable "AnyStr" of "dirname" cannot be "Optional[str]"
+ rich/traceback.py:252: error: Value of type variable "AnyStr" of "normpath" cannot be "Optional[str]"
+ rich/traceback.py:252: error: Value of type variable "AnyStr" of "abspath" cannot be "Optional[str]"
+ rich/traceback.py:253: error: Argument 1 to "append" of "list" has incompatible type "Optional[str]"; expected "str"
edgedb (https://github.com/edgedb/edgedb.git)
+ edb/server/pgconnparams.py:75: error: Unused "type: ignore" comment
+ edb/schema/objects.py:997: error: Unused "type: ignore" comment
+ edb/schema/objects.py:1992:9: error: Returning Any from function declared to return "QualName"
+ edb/schema/objects.py:2223: error: Unused "type: ignore" comment
+ edb/schema/objects.py:2637:9: error: Returning Any from function declared to return "Name"
+ edb/schema/schema.py:1146:9: error: Returning Any from function declared to return "FrozenSet[Cast]"
+ edb/schema/schema.py:1156:9: error: Returning Any from function declared to return "FrozenSet[Cast]"
+ edb/schema/schema.py:1166:9: error: Returning Any from function declared to return "FrozenSet[so.Object_T]"
+ edb/schema/schema.py:1412:9: error: Returning Any from function declared to return "Optional[Migration]"
+ edb/schema/scalars.py:132:9: error: Returning Any from function declared to return "bool"
+ edb/schema/scalars.py:163:9: error: Returning Any from function declared to return "bool"
+ edb/schema/scalars.py:176:9: error: Returning Any from function declared to return "int"
+ edb/schema/casts.py:91:5: error: Returning Any from function declared to return "bool"
+ edb/schema/casts.py:119:21: error: Returning Any from function declared to return "Optional[Type]"
pytest (https://github.com/pytest-dev/pytest.git)
+ src/_pytest/pathlib.py:542: error: Item "None" of "Optional[str]" has no attribute "endswith" [union-attr]
+ src/_pytest/pathlib.py:543: error: Value of type "Optional[str]" is not indexable [index]
+ src/_pytest/pathlib.py:544: error: Item "None" of "Optional[str]" has no attribute "endswith" [union-attr]
+ src/_pytest/pathlib.py:545: error: Value of type "Optional[str]" is not indexable [index]
+ src/_pytest/pathlib.py:548: error: Argument 2 to "_is_same" has incompatible type "Optional[str]"; expected "str" [arg-type]
+ src/_pytest/config/__init__.py:1440: error: Argument 1 to "Path" has incompatible type "Optional[str]"; expected "Union[str, PathLike[str]]" [arg-type]
- src/_pytest/config/__init__.py:1683: error: Argument 1 to "filterwarnings" has incompatible type "*Tuple[str, str, Type[Warning], str, int]"; expected "Union[Literal['default'], Literal['error'], Literal['ignore'], Literal['always'], Literal['module'], Literal['once']]" [arg-type]
- src/_pytest/config/__init__.py:1686: error: Argument 1 to "filterwarnings" has incompatible type "*Tuple[str, str, Type[Warning], str, int]"; expected "Union[Literal['default'], Literal['error'], Literal['ignore'], Literal['always'], Literal['module'], Literal['once']]" [arg-type]
- src/_pytest/fixtures.py:1323: error: Unexpected keyword argument "ids" for "FixtureFunctionMarker" [call-arg]
- src/_pytest/fixtures.py:1323: error: Unexpected keyword argument "name" for "FixtureFunctionMarker" [call-arg]
- src/_pytest/fixtures.py:1468: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ src/_pytest/fixtures.py:1323: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
anyio (https://github.com/agronholm/anyio.git)
+ src/anyio/_core/_eventloop.py:56: error: Unused "type: ignore" comment
kornia (https://github.com/kornia/kornia.git)
- kornia/testing/__init__.py:16: error: Module has no attribute "util" [attr-defined]
|
|
Test failures aside, this also includes python/typeshed#6221 which as things currently stand would be a bit of a regression for mypy users |
I'd rather avoid the regression. We could work around this using a plugin, but that's not very principled. I'm going to instead look at adding support for |
I did some prototyping and real |
|
Nice! Yeah, in particular the basic "change the callable return type" needed for this PR should be quite easy to knock out. I think I have a version of that on a branch, and then I got distracted and started refactoring type variables and trying to fix generics leakage. |
|
Cool! I'll try to prepare a PR that implements basic |
|
I'm going to create another PR based on a more recent typeshed commit. |
Source commit:
python/typeshed@fbb89f9