-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Detailed 'signature incompatible with supertype' for non-callables #15263
Detailed 'signature incompatible with supertype' for non-callables #15263
Conversation
This comment has been minimized.
This comment has been minimized.
p.s. given how common cases like this are + discord/channel.py:223: note: Superclass:
+ discord/channel.py:223: note: ChannelType
+ discord/channel.py:223: note: Subclass:
+ discord/channel.py:223: note: Literal[ChannelType.text, ChannelType.news] would it be useful for this case to emit the "This violates the Liskov substitution principle" notes too, or is it too much text and/or we're being too prescriptive? cc @ChetanKhanna who authored (and @JukkaL who reviewed) #8866 |
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/context/slash.py:1044: note: Superclass:
+ tanjun/context/slash.py:1044: note: Optional[ExecutableCommand[SlashContext]]
+ tanjun/context/slash.py:1044: note: Subclass:
+ tanjun/context/slash.py:1044: note: Optional[BaseSlashCommand]
+ tanjun/context/message.py:130: note: Superclass:
+ tanjun/context/message.py:130: note: Optional[ExecutableCommand[MessageContext]]
+ tanjun/context/message.py:130: note: Subclass:
+ tanjun/context/message.py:130: note: Optional[MessageCommand[Any]]
+ tanjun/context/menu.py:101: note: Superclass:
+ tanjun/context/menu.py:101: note: Optional[ExecutableCommand[MenuContext]]
+ tanjun/context/menu.py:101: note: Subclass:
+ tanjun/context/menu.py:101: note: Optional[MenuCommand[Any, Any]]
manticore (https://github.com/trailofbits/manticore)
+ manticore/platforms/linux.py:359: note: Superclass:
+ manticore/platforms/linux.py:359: note: bool
+ manticore/platforms/linux.py:359: note: Subclass:
+ manticore/platforms/linux.py:359: note: def closed(self) -> bool
Auto-Split (https://github.com/Avasam/Auto-Split)
+ src/capture_method/__init__.py:102: note: Superclass:
+ src/capture_method/__init__.py:102: note: Subclass:
+ src/capture_method/__init__.py:102: note: Superclass:
+ src/capture_method/__init__.py:102: note: Subclass:
+ src/capture_method/__init__.py:102: note: Superclass:
+ src/capture_method/__init__.py:102: note: Subclass:
sublime_debugger (https://github.com/daveleroy/sublime_debugger)
+ modules/ui/html.py:244: note: Superclass:
+ modules/ui/html.py:244: note: float | None
+ modules/ui/html.py:244: note: Subclass:
+ modules/ui/html.py:244: note: def width(self) -> float
+ modules/ui/html.py:244: note: Superclass:
+ modules/ui/html.py:244: note: float | None
+ modules/ui/html.py:244: note: Subclass:
+ modules/ui/html.py:244: note: def width(self) -> float
+ modules/breakpoints/data_breakpoints.py:26: note: Superclass:
+ modules/breakpoints/data_breakpoints.py:26: note: str
+ modules/breakpoints/data_breakpoints.py:26: note: Subclass:
+ modules/breakpoints/data_breakpoints.py:26: note: str | None
operator (https://github.com/canonical/operator)
+ ops/model.py:783: note: Superclass:
+ ops/model.py:783: note: Subclass:
+ ops/framework.py:1252: note: Superclass:
+ ops/framework.py:1252: note: Subclass:
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/commands/utils.py:36: note: Superclass:
+ steam/ext/commands/utils.py:36: note: Subclass:
+ steam/ext/commands/utils.py:47: note: Superclass:
+ steam/ext/commands/utils.py:47: note: Subclass:
+ steam/ext/commands/help.py:130: note: Superclass:
+ steam/ext/commands/help.py:130: note: Err
+ steam/ext/commands/help.py:130: note: Subclass:
+ steam/ext/commands/help.py:130: note: def on_error(self, ctx: Context, error: Exception) -> Coroutine[Any, Any, None]
spark (https://github.com/apache/spark)
+ python/pyspark/ml/classification.py:877: note: Superclass:
+ python/pyspark/ml/classification.py:877: note: LinearSVCTrainingSummary
+ python/pyspark/ml/classification.py:877: note: Subclass:
+ python/pyspark/ml/classification.py:877: note: def summary(self) -> LinearSVCTrainingSummary
+ python/pyspark/ml/classification.py:3323: note: Superclass:
+ python/pyspark/ml/classification.py:3323: note: MultilayerPerceptronClassificationTrainingSummary
+ python/pyspark/ml/classification.py:3323: note: Subclass:
+ python/pyspark/ml/classification.py:3323: note: def summary(self) -> MultilayerPerceptronClassificationTrainingSummary
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/utilities/annotations.py:48: note: Superclass:
+ src/prefect/utilities/annotations.py:48: note: Subclass:
+ src/prefect/_internal/concurrency/api.py:158: note: Superclass:
+ src/prefect/_internal/concurrency/api.py:158: note: abstractstaticmethod[[Callable[[], T] | Call[T], float | None, Iterable[Call[Any]] | None], T]
+ src/prefect/_internal/concurrency/api.py:158: note: Subclass:
+ src/prefect/_internal/concurrency/api.py:158: note: @staticmethod
+ src/prefect/_internal/concurrency/api.py:158: note: def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:176: note: Superclass:
+ src/prefect/_internal/concurrency/api.py:176: note: abstractstaticmethod[[Callable[[], T] | Call[T], float | None, Iterable[Call[Any]] | None], T]
+ src/prefect/_internal/concurrency/api.py:176: note: Subclass:
+ src/prefect/_internal/concurrency/api.py:176: note: @staticmethod
+ src/prefect/_internal/concurrency/api.py:176: note: def [T] wait_for_call_in_new_thread(Callable[[], T] | Call[T], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ...) -> Coroutine[Any, Any, Call[T]]
+ src/prefect/_internal/concurrency/api.py:214: note: Superclass:
+ src/prefect/_internal/concurrency/api.py:214: note: abstractstaticmethod[[Callable[[], T] | Call[T], float | None, Iterable[Call[Any]] | None], T]
+ src/prefect/_internal/concurrency/api.py:214: note: Subclass:
+ src/prefect/_internal/concurrency/api.py:214: note: @staticmethod
+ src/prefect/_internal/concurrency/api.py:214: note: def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:235: note: Superclass:
+ src/prefect/_internal/concurrency/api.py:235: note: abstractstaticmethod[[Callable[[], T] | Call[T], float | None, Iterable[Call[Any]] | None], T]
+ src/prefect/_internal/concurrency/api.py:235: note: Subclass:
+ src/prefect/_internal/concurrency/api.py:235: note: @staticmethod
+ src/prefect/_internal/concurrency/api.py:235: note: def [T] wait_for_call_in_new_thread(Callable[[], T] | Call[T], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ...) -> Call[T]
+ src/prefect/results.py:402: note: Superclass:
+ src/prefect/results.py:402: note: abstractclassmethod[type[BaseResult[R]], [R, KwArg(Any)], Coroutine[Any, Any, BaseResult[R]]]
+ src/prefect/results.py:402: note: Subclass:
+ src/prefect/results.py:402: note: @classmethod
+ src/prefect/results.py:402: note: def [R] create(cls, obj: R, cache_object: bool = ...) -> Coroutine[Any, Any, UnpersistedResult]
+ src/prefect/results.py:439: note: Superclass:
+ src/prefect/results.py:439: note: abstractclassmethod[type[BaseResult[R]], [R, KwArg(Any)], Coroutine[Any, Any, BaseResult[R]]]
+ src/prefect/results.py:439: note: Subclass:
+ src/prefect/results.py:439: note: @classmethod
+ src/prefect/results.py:439: note: def [R] create(cls, obj: R) -> Coroutine[Any, Any, LiteralResult]
+ src/prefect/results.py:511: note: Superclass:
+ src/prefect/results.py:511: note: abstractclassmethod[type[BaseResult[R]], [R, KwArg(Any)], Coroutine[Any, Any, BaseResult[R]]]
+ src/prefect/results.py:511: note: Subclass:
+ src/prefect/results.py:511: note: @classmethod
+ src/prefect/results.py:511: note: def [R] create(cls, obj: R, storage_block: WritableFileSystem, storage_block_id: UUID, storage_key_fn: Callable[[], str], serializer: Serializer[Any], cache_object: bool = ...) -> Coroutine[Any, Any, PersistedResult]
ibis (https://github.com/ibis-project/ibis)
+ ibis/common/grounds.py:93: note: Superclass:
+ ibis/common/grounds.py:93: note: classmethod[type, [VarArg(Any), KwArg(Any)], Any]
+ ibis/common/grounds.py:93: note: Subclass:
+ ibis/common/grounds.py:93: note: @classmethod
+ ibis/common/grounds.py:93: note: def __create__(cls, *args: Any, **kwargs: Any) -> Annotable
+ ibis/common/grounds.py:175: note: Superclass:
+ ibis/common/grounds.py:175: note: classmethod[type, [VarArg(Any), KwArg(Any)], Any]
+ ibis/common/grounds.py:175: note: Subclass:
+ ibis/common/grounds.py:175: note: @classmethod
+ ibis/common/grounds.py:175: note: def __create__(cls, *args: Any, **kwargs: Any) -> Singleton
+ ibis/expr/operations/window.py:47: note: Superclass:
+ ibis/expr/operations/window.py:47: note: DataType
+ ibis/expr/operations/window.py:47: note: Subclass:
+ ibis/expr/operations/window.py:47: note: def output_dtype(self) -> DataType
+ ibis/backends/datafusion/__init__.py:64: note: Superclass:
+ ibis/backends/datafusion/__init__.py:64: note: str | None
+ ibis/backends/datafusion/__init__.py:64: note: Subclass:
+ ibis/backends/datafusion/__init__.py:64: note: def current_database(self) -> str
+ ibis/backends/pyspark/__init__.py:570: note: Superclass:
+ ibis/backends/pyspark/__init__.py:570: note: Subclass:
+ ibis/backends/dask/__init__.py:96: note: Superclass:
+ ibis/backends/dask/__init__.py:96: note: Subclass:
+ ibis/backends/trino/__init__.py:26: note: Superclass:
+ ibis/backends/trino/__init__.py:26: note: str
+ ibis/backends/trino/__init__.py:26: note: Subclass:
+ ibis/backends/trino/__init__.py:26: note: def current_database(self) -> str
+ ibis/backends/trino/__init__.py:26: note: Superclass:
+ ibis/backends/trino/__init__.py:26: note: str | None
+ ibis/backends/trino/__init__.py:26: note: Subclass:
+ ibis/backends/trino/__init__.py:26: note: def current_database(self) -> str
+ ibis/backends/duckdb/__init__.py:62: note: Superclass:
+ ibis/backends/duckdb/__init__.py:62: note: str
+ ibis/backends/duckdb/__init__.py:62: note: Subclass:
+ ibis/backends/duckdb/__init__.py:62: note: def current_database(self) -> str
+ ibis/backends/duckdb/__init__.py:62: note: Superclass:
+ ibis/backends/duckdb/__init__.py:62: note: str | None
+ ibis/backends/duckdb/__init__.py:62: note: Subclass:
+ ibis/backends/duckdb/__init__.py:62: note: def current_database(self) -> str
discord.py (https://github.com/Rapptz/discord.py)
+ discord/invite.py:507: note: Superclass:
+ discord/invite.py:507: note: int
+ discord/invite.py:507: note: Subclass:
+ discord/invite.py:507: note: str
+ discord/channel.py:223: note: Superclass:
+ discord/channel.py:223: note: ChannelType
+ discord/channel.py:223: note: Subclass:
+ discord/channel.py:223: note: Literal[ChannelType.text, ChannelType.news]
+ discord/channel.py:1341: note: Superclass:
+ discord/channel.py:1341: note: ChannelType
+ discord/channel.py:1341: note: Subclass:
+ discord/channel.py:1341: note: Literal[ChannelType.voice]
+ discord/channel.py:1580: note: Superclass:
+ discord/channel.py:1580: note: ChannelType
+ discord/channel.py:1580: note: Subclass:
+ discord/channel.py:1580: note: Literal[ChannelType.stage_voice]
+ discord/channel.py:1845: note: Superclass:
+ discord/channel.py:1845: note: ChannelType
+ discord/channel.py:1845: note: Subclass:
+ discord/channel.py:1845: note: Literal[ChannelType.category]
+ discord/channel.py:2260: note: Superclass:
+ discord/channel.py:2260: note: ChannelType
+ discord/channel.py:2260: note: Subclass:
+ discord/channel.py:2260: note: Literal[ChannelType.forum]
+ discord/webhook/sync.py:406: note: Superclass:
+ discord/webhook/sync.py:406: note: Subclass:
+ discord/webhook/async_.py:774: note: Superclass:
+ discord/webhook/async_.py:774: note: Subclass:
+ discord/ui/select.py:298: note: Superclass:
+ discord/ui/select.py:298: note: list[str | User | Member | Role | AppCommandChannel | AppCommandThread | Role | Member | Role | User]
+ discord/ui/select.py:298: note: Subclass:
+ discord/ui/select.py:298: note: list[str]
+ discord/ui/select.py:446: note: Superclass:
+ discord/ui/select.py:446: note: list[str | User | Member | Role | AppCommandChannel | AppCommandThread | Role | Member | Role | User]
+ discord/ui/select.py:446: note: Subclass:
+ discord/ui/select.py:446: note: list[Member | User]
+ discord/ui/select.py:515: note: Superclass:
+ discord/ui/select.py:515: note: list[str | User | Member | Role | AppCommandChannel | AppCommandThread | Role | Member | Role | User]
+ discord/ui/select.py:515: note: Subclass:
+ discord/ui/select.py:515: note: list[Role]
+ discord/ui/select.py:579: note: Superclass:
+ discord/ui/select.py:579: note: list[str | User | Member | Role | AppCommandChannel | AppCommandThread | Role | Member | Role | User]
+ discord/ui/select.py:579: note: Subclass:
+ discord/ui/select.py:579: note: list[Member | User | Role]
+ discord/ui/select.py:668: note: Superclass:
+ discord/ui/select.py:668: note: list[str | User | Member | Role | AppCommandChannel | AppCommandThread | Role | Member | Role | User]
+ discord/ui/select.py:668: note: Subclass:
+ discord/ui/select.py:668: note: list[AppCommandChannel | AppCommandThread]
|
Seeing duplication in AutoSplit:
I don't think we should address it here. Rather, let's address holistically in #15273. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great!
Previously the "signature incompatible with supertype" error only included detailed comparison when both types are callables; now it will compare in all cases.