-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix and simplify error de-duplication #19247
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
I like the |
Hm, it looks like it may also fix couple other issues. I will check now, and add tests if yes. |
Results look amazing, this should also fix duplicated compatibility notes in #19168. |
Diff from mypy_primer, showing the effect of this PR on open source code: colour (https://github.com/colour-science/colour)
+ colour/algebra/tests/test_extrapolation.py:140: note: Setter types should behave contravariantly
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/settings/legacy.py:136: note: Expected:
- src/prefect/settings/legacy.py:136: note: def __hash__() -> int
- src/prefect/settings/legacy.py:136: note: Got:
- src/prefect/settings/legacy.py:136: note: def __hash__(self: object) -> int
- ...:136: note: "__init_subclass__" of "object" defined here
- ...:136: note: "__init_subclass__" of "object" defined here
- ...:136: note: "__init_subclass__" of "object" defined here
- ...:136: note: "__init_subclass__" of "object" defined here
tornado (https://github.com/tornadoweb/tornado)
- tornado/test/web_test.py:1539: note: Superclass:
- tornado/test/web_test.py:1539: note: @classmethod
- tornado/test/web_test.py:1539: note: def make_static_url(cls, settings: dict[str, Any], path: str, include_version: bool = ...) -> str
- tornado/test/web_test.py:1539: note: Subclass:
- tornado/test/web_test.py:1539: note: @classmethod
- tornado/test/web_test.py:1539: note: def make_static_url(cls, settings: Any, path: Any) -> Any
ibis (https://github.com/ibis-project/ibis)
- ibis/backends/snowflake/__init__.py:464: note: Superclass:
- ibis/backends/snowflake/__init__.py:464: note: def to_pandas_batches(self, Expr, /, *, params: Mapping[Scalar, Any] | None = ..., limit: int | str | None = ..., chunk_size: int = ..., **kwargs: Any) -> Iterator[DataFrame | Series[Any] | Any]
- ibis/backends/snowflake/__init__.py:464: note: Subclass:
- ibis/backends/snowflake/__init__.py:464: note: def to_pandas_batches(self, Expr, /, *, params: Mapping[Scalar, Any] | None = ..., limit: int | str | None = ..., chunk_size: int = ...) -> Iterator[DataFrame | Series[Any] | Any]
- ibis/backends/mysql/__init__.py:157: note: Superclass:
- ibis/backends/mysql/__init__.py:157: note: def list_databases(self, *, like: str | None = ..., catalog: str | None = ...) -> list[str]
- ibis/backends/mysql/__init__.py:157: note: Subclass:
- ibis/backends/mysql/__init__.py:157: note: def list_databases(self, *, like: str | None = ...) -> list[str]
- ibis/backends/mysql/__init__.py:222: note: Superclass:
- ibis/backends/mysql/__init__.py:222: note: def create_database(self, str, /, *, catalog: str | None = ..., force: bool = ...) -> None
- ibis/backends/mysql/__init__.py:222: note: Subclass:
- ibis/backends/mysql/__init__.py:222: note: def create_database(self, name: str, force: bool = ...) -> None
- ibis/backends/impala/__init__.py:206: note: Superclass:
- ibis/backends/impala/__init__.py:206: note: def list_databases(self, *, like: str | None = ..., catalog: str | None = ...) -> list[str]
- ibis/backends/impala/__init__.py:206: note: Subclass:
- ibis/backends/impala/__init__.py:206: note: def list_databases(self, *, like: str | None = ...) -> list[str]
- ...:114: note: "__init__" of "object" defined here
- ...:114: note: "__init__" of "object" defined here
hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/core/netcdftools.py:489: note: Expected:
- hydpy/core/netcdftools.py:489: note: def __iter__(self) -> Iterator[Buffer]
- hydpy/core/netcdftools.py:489: note: Got:
- hydpy/core/netcdftools.py:489: note: def __iter__(self) -> Iterator[int]
yarl (https://github.com/aio-libs/yarl)
+ yarl/_url.py:1266:23: note: keys
+ yarl/_url.py:1266:23: note: Following member(s) of "str" have conflicts:
+ yarl/_url.py:1266:23: note: Following member(s) of "str" have conflicts:
starlette (https://github.com/encode/starlette)
- starlette/websockets.py:21: note: "WebSocketDenialResponse" defined here
- starlette/websockets.py:21: note: "WebSocketDenialResponse" defined here
freqtrade (https://github.com/freqtrade/freqtrade)
- ...:1314: note: "infer_objects" of "Series" defined here
discord.py (https://github.com/Rapptz/discord.py)
- ...:1014: note: "update" of "TypedDict" defined here
zulip (https://github.com/zulip/zulip)
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
- ...:114: note: "SubTest" defined here
sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In function "apply":
- sphinx/transforms/__init__.py:433:32: error: Call to untyped function "astext" in typed context [no-untyped-call]
- sphinx/transforms/__init__.py: note: In member "apply" of class "GlossarySorter":
- sphinx/transforms/__init__.py:433:32: error: Call to untyped function "astext" in typed context [no-untyped-call]
- sphinx/transforms/__init__.py: note: In function "apply":
- sphinx/transforms/__init__.py:433:32: error: Call to untyped function "astext" in typed context [no-untyped-call]
|
Fixes #19240
Fixes #13517
Fixes #17791
Existing de-duplication logic is both complicated and fragile. By specifying a
parent_error
for a note explicitly, we can do everything in a more robust and simple way. In addition, this new argument makes error code matching simpler.