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

Surface lowercase type instead of Type in error messages on Python 3.9 and above #15139

Merged
merged 1 commit into from Apr 26, 2023

Conversation

rohitsanj
Copy link
Contributor

Fixes #13027 (or at least half of it)

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

apprise (https://github.com/caronc/apprise)
- apprise/logger.py:69: error: "Type[Logger]" has no attribute "trace"  [attr-defined]
+ apprise/logger.py:69: error: "type[Logger]" has no attribute "trace"  [attr-defined]
- apprise/logger.py:70: error: "Type[Logger]" has no attribute "deprecate"  [attr-defined]
+ apprise/logger.py:70: error: "type[Logger]" has no attribute "deprecate"  [attr-defined]
- apprise/plugins/NotifyWindows.py:103: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyWindows.py:103: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifySyslog.py:158: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifySyslog.py:158: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifySyslog.py:180: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifySyslog.py:180: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyMacOSX.py:117: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyMacOSX.py:117: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyMQTT.py:150: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyMQTT.py:150: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyMQTT.py:185: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyMQTT.py:185: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyGrowl.py:145: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyGrowl.py:145: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyGrowl.py:165: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyGrowl.py:165: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyGnome.py:148: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyGnome.py:148: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyEmail.py:366: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyEmail.py:366: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyEmail.py:393: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyEmail.py:393: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyEmail.py:841: error: Incompatible types in assignment (expression has type "Type[SMTP_SSL]", variable has type "Type[SMTP]")  [assignment]
+ apprise/plugins/NotifyEmail.py:841: error: Incompatible types in assignment (expression has type "type[SMTP_SSL]", variable has type "type[SMTP]")  [assignment]
- apprise/plugins/NotifyDBus.py:212: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyDBus.py:212: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyZulip.py:129: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyZulip.py:129: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyZulip.py:165: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyZulip.py:165: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyXML.py:97: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyXML.py:97: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyXML.py:122: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyXML.py:122: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyXBMC.py:98: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyXBMC.py:98: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyXBMC.py:122: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyXBMC.py:122: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyWebexTeams.py:121: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyWebexTeams.py:121: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyVonage.py:83: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyVonage.py:83: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyVonage.py:119: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyVonage.py:119: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyVoipms.py:86: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyVoipms.py:86: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyVoipms.py:118: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyVoipms.py:118: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyTwitter.py:138: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyTwitter.py:138: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyTwitter.py:176: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyTwitter.py:176: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyTwist.py:104: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyTwist.py:104: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyTwist.py:132: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyTwist.py:132: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyTwilio.py:105: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyTwilio.py:105: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyTwilio.py:147: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyTwilio.py:147: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyTelegram.py:268: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyTelegram.py:268: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyTelegram.py:292: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyTelegram.py:292: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifyTechulusPush.py:100: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyTechulusPush.py:100: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyStreamlabs.py:110: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifyStreamlabs.py:110: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifyStreamlabs.py:121: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifyStreamlabs.py:121: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifySpontit.py:111: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifySpontit.py:111: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifySpontit.py:143: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifySpontit.py:143: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifySparkPost.py:160: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifySparkPost.py:160: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifySparkPost.py:184: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifySparkPost.py:184: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]
- apprise/plugins/NotifySlack.py:179: error: "Type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
+ apprise/plugins/NotifySlack.py:179: error: "type[NotifyBase]" has no attribute "template_tokens"  [attr-defined]
- apprise/plugins/NotifySlack.py:252: error: "Type[NotifyBase]" has no attribute "template_args"  [attr-defined]
+ apprise/plugins/NotifySlack.py:252: error: "type[NotifyBase]" has no attribute "template_args"  [attr-defined]

... (truncated 248 lines) ...

Auto-Split (https://github.com/Avasam/Auto-Split)
- src/capture_method/__init__.py:85: error: Incompatible types in assignment (expression has type "None", base class "dict" defined the type as "Callable[[dict[CaptureMethodEnum, Type[CaptureMethodBase]], CaptureMethodEnum], Type[CaptureMethodBase]]")  [assignment]
+ src/capture_method/__init__.py:85: error: Incompatible types in assignment (expression has type "None", base class "dict" defined the type as "Callable[[dict[CaptureMethodEnum, type[CaptureMethodBase]], CaptureMethodEnum], type[CaptureMethodBase]]")  [assignment]
- src/capture_method/__init__.py:87: note:          def get(self, CaptureMethodEnum, /) -> Type[CaptureMethodBase] | None
+ src/capture_method/__init__.py:87: note:          def get(self, CaptureMethodEnum, /) -> type[CaptureMethodBase] | None
- src/capture_method/__init__.py:87: note:          def [_T] get(self, CaptureMethodEnum, Type[CaptureMethodBase] | _T, /) -> Type[CaptureMethodBase] | _T
+ src/capture_method/__init__.py:87: note:          def [_T] get(self, CaptureMethodEnum, type[CaptureMethodBase] | _T, /) -> type[CaptureMethodBase] | _T
- src/capture_method/__init__.py:87: note:          def get(self, CaptureMethodEnum, /) -> Type[CaptureMethodBase] | None
+ src/capture_method/__init__.py:87: note:          def get(self, CaptureMethodEnum, /) -> type[CaptureMethodBase] | None
- src/capture_method/__init__.py:87: note:          def [_T] get(self, CaptureMethodEnum, /, default: Type[CaptureMethodBase] | _T) -> Type[CaptureMethodBase] | _T
+ src/capture_method/__init__.py:87: note:          def [_T] get(self, CaptureMethodEnum, /, default: type[CaptureMethodBase] | _T) -> type[CaptureMethodBase] | _T

pylox (https://github.com/sco1/pylox)
- pylox/containers/array.py:146: error: Incompatible types in assignment (expression has type "Type[LoxArray]", variable has type "LoxClass")  [assignment]
+ pylox/containers/array.py:146: error: Incompatible types in assignment (expression has type "type[LoxArray]", variable has type "LoxClass")  [assignment]

sublime_debugger (https://github.com/daveleroy/sublime_debugger)
- modules/libs/ptyprocess/ptyprocess.py:795: error: Incompatible types in assignment (expression has type "Type[str]", base class "PtyProcess" defined the type as "Type[bytes]")  [assignment]
+ modules/libs/ptyprocess/ptyprocess.py:795: error: Incompatible types in assignment (expression has type "type[str]", base class "PtyProcess" defined the type as "type[bytes]")  [assignment]

operator (https://github.com/canonical/operator)
- ops/log.py:70: error: Incompatible types in assignment (expression has type "Callable[[Type[BaseException], BaseException, TracebackType], Any]", variable has type "Callable[[Type[BaseException], BaseException, TracebackType | None], Any]")  [assignment]
+ ops/log.py:70: error: Incompatible types in assignment (expression has type "Callable[[type[BaseException], BaseException, TracebackType], Any]", variable has type "Callable[[type[BaseException], BaseException, TracebackType | None], Any]")  [assignment]
- ops/framework.py:718: error: Incompatible types in assignment (expression has type "Type[_Serializable] | None", variable has type "Type[_Serializable]")  [assignment]
+ ops/framework.py:718: error: Incompatible types in assignment (expression has type "type[_Serializable] | None", variable has type "type[_Serializable]")  [assignment]
- ops/testing.py:2203: error: Incompatible types in assignment (expression has type "_TestingModelBackend", variable has type "Type[_TestingModelBackend]")  [assignment]
+ ops/testing.py:2203: error: Incompatible types in assignment (expression has type "_TestingModelBackend", variable has type "type[_TestingModelBackend]")  [assignment]

steam.py (https://github.com/Gobot1234/steam.py)
- steam/trade.py:261: error: The type "Type[Item]" is not generic and not indexable  [misc]
+ steam/trade.py:261: error: The type "type[Item]" is not generic and not indexable  [misc]
- steam/game_server.py:146: error: Argument "type" to "Query" has incompatible type "Type[list[Any]]"; expected "Type[list[str]] | tuple[Type[list[str]], ...] | None"  [arg-type]
+ steam/game_server.py:146: error: Argument "type" to "Query" has incompatible type "type[list[Any]]"; expected "type[list[str]] | tuple[type[list[str]], ...] | None"  [arg-type]
- steam/game_server.py:151: error: Argument "type" to "Query" has incompatible type "Type[list[Any]]"; expected "Type[list[str]] | tuple[Type[list[str]], ...] | None"  [arg-type]
+ steam/game_server.py:151: error: Argument "type" to "Query" has incompatible type "type[list[Any]]"; expected "type[list[str]] | tuple[type[list[str]], ...] | None"  [arg-type]
- steam/game_server.py:156: error: Argument "type" to "Query" has incompatible type "Type[list[Any]]"; expected "Type[list[str]] | tuple[Type[list[str]], ...] | None"  [arg-type]
+ steam/game_server.py:156: error: Argument "type" to "Query" has incompatible type "type[list[Any]]"; expected "type[list[str]] | tuple[type[list[str]], ...] | None"  [arg-type]
- steam/gateway.py:724: note:     def wait_for(self, msg: Type[MsgT?], *, check: Callable[[MsgT?], bool] = ...) -> Future[MsgT?]
+ steam/gateway.py:724: note:     def wait_for(self, msg: type[MsgT?], *, check: Callable[[MsgT?], bool] = ...) -> Future[MsgT?]
- steam/gateway.py:724: note:     def wait_for(self, msg: Type[ProtoMsgT?], *, check: Callable[[ProtoMsgT?], bool] = ...) -> Future[ProtoMsgT?]
+ steam/gateway.py:724: note:     def wait_for(self, msg: type[ProtoMsgT?], *, check: Callable[[ProtoMsgT?], bool] = ...) -> Future[ProtoMsgT?]
- steam/chat.py:579: error: Argument 2 to "__get__" of "classproperty" has incompatible type "Type[ChatGroup]"; expected "Type[Self]"  [arg-type]
+ steam/chat.py:579: error: Argument 2 to "__get__" of "classproperty" has incompatible type "type[ChatGroup]"; expected "type[Self]"  [arg-type]
- steam/chat.py:598: error: Argument 2 to "__get__" of "classproperty" has incompatible type "Type[ChatGroup]"; expected "Type[Self]"  [arg-type]
+ steam/chat.py:598: error: Argument 2 to "__get__" of "classproperty" has incompatible type "type[ChatGroup]"; expected "type[Self]"  [arg-type]
- steam/chat.py:658: error: Argument 2 to "__get__" of "classproperty" has incompatible type "Type[ChatGroup]"; expected "Type[Self]"  [arg-type]
+ steam/chat.py:658: error: Argument 2 to "__get__" of "classproperty" has incompatible type "type[ChatGroup]"; expected "type[Self]"  [arg-type]
- steam/chat.py:669: error: Argument 2 to "__get__" of "classproperty" has incompatible type "Type[ChatGroup]"; expected "Type[Self]"  [arg-type]
+ steam/chat.py:669: error: Argument 2 to "__get__" of "classproperty" has incompatible type "type[ChatGroup]"; expected "type[Self]"  [arg-type]
- steam/state.py:1638: error: Argument 2 to "__get__" of "classproperty" has incompatible type "Type[Awardable]"; expected "Type[Self]"  [arg-type]
+ steam/state.py:1638: error: Argument 2 to "__get__" of "classproperty" has incompatible type "type[Awardable]"; expected "type[Self]"  [arg-type]
- steam/ext/_gc/state.py:116: error: "Type[GCMsgsT?]" has no attribute "MSG"  [attr-defined]
+ steam/ext/_gc/state.py:116: error: "type[GCMsgsT?]" has no attribute "MSG"  [attr-defined]
- steam/client.py:1159: error: The type "Type[TradeOffer]" is not generic and not indexable  [misc]
+ steam/client.py:1159: error: The type "type[TradeOffer]" is not generic and not indexable  [misc]
- steam/ext/commands/converters.py:262: error: Incompatible types in assignment (expression has type "Type[Converter[T_co]]", target has type "ConverterBase[Any] | BasicConverter[Any]")  [assignment]
+ steam/ext/commands/converters.py:262: error: Incompatible types in assignment (expression has type "type[Converter[T_co]]", target has type "ConverterBase[Any] | BasicConverter[Any]")  [assignment]
- steam/ext/commands/converters.py:262: note:     converter_for: expected "Type[Any]", got "Callable[[], T_co]"
+ steam/ext/commands/converters.py:262: note:     converter_for: expected "type[Any]", got "Callable[[], T_co]"
- steam/ext/commands/commands.py:518: error: Argument 1 to "index" of "list" has incompatible type "ConverterBase[Any] | BasicConverter[Any]"; expected "Type[Converter[Any]]"  [arg-type]
+ steam/ext/commands/commands.py:518: error: Argument 1 to "index" of "list" has incompatible type "ConverterBase[Any] | BasicConverter[Any]"; expected "type[Converter[Any]]"  [arg-type]
- steam/ext/commands/commands.py:522: error: Incompatible return value type (got "Type[Converter[Any]]", expected "ConverterBase[Any] | BasicConverter[Any]")  [return-value]
+ steam/ext/commands/commands.py:522: error: Incompatible return value type (got "type[Converter[Any]]", expected "ConverterBase[Any] | BasicConverter[Any]")  [return-value]
- steam/ext/commands/commands.py:998: error: No overload variant of "command" matches argument types "CallT | None", "str | None", "Type[G] | Type[Group[Any]]", "dict[str, Any]"  [call-overload]
+ steam/ext/commands/commands.py:998: error: No overload variant of "command" matches argument types "CallT | None", "str | None", "type[G] | type[Group[Any]]", "dict[str, Any]"  [call-overload]
- steam/ext/commands/commands.py:998: note:     def [C <: Command[Any]] command(*, name: str | None = ..., cls: Type[C] | None = ..., help: str | None = ..., brief: str | None = ..., usage: str | None = ..., description: str | None = ..., aliases: Iterable[str] | None = ..., checks: list[CheckReturnType] = ..., cooldown: list[Cooldown[Any]] = ..., special_converters: list[Type[ConverterBase[Any]] | Type[BasicConverter[Any]]] = ..., cog: Cog | None = ..., parent: Command[Any] | None = ..., enabled: bool = ..., hidden: bool = ..., case_insensitive: bool = ...) -> Callable[[Callable[P, Coroutine[Any, Any, Any]]], Command[P]]
+ steam/ext/commands/commands.py:998: note:     def [C <: Command[Any]] command(*, name: str | None = ..., cls: type[C] | None = ..., help: str | None = ..., brief: str | None = ..., usage: str | None = ..., description: str | None = ..., aliases: Iterable[str] | None = ..., checks: list[CheckReturnType] = ..., cooldown: list[Cooldown[Any]] = ..., special_converters: list[type[ConverterBase[Any]] | type[BasicConverter[Any]]] = ..., cog: Cog | None = ..., parent: Command[Any] | None = ..., enabled: bool = ..., hidden: bool = ..., case_insensitive: bool = ...) -> Callable[[Callable[P, Coroutine[Any, Any, Any]]], Command[P]]
- steam/ext/commands/bot.py:540: error: Incompatible default for argument "cls" (default has type "Type[Context]", argument has type "Type[C]")  [assignment]
+ steam/ext/commands/bot.py:540: error: Incompatible default for argument "cls" (default has type "type[Context]", argument has type "type[C]")  [assignment]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/neighbors/tests/test_graph.py:84: error: List item 0 has incompatible type "Type[KNeighborsTransformer]"; expected "Type[NeighborsBase]"  [list-item]
+ sklearn/neighbors/tests/test_graph.py:84: error: List item 0 has incompatible type "type[KNeighborsTransformer]"; expected "type[NeighborsBase]"  [list-item]
- sklearn/svm/tests/test_svm.py:582: error: List item 1 has incompatible type "tuple[Type[NuSVC], str]"; expected "tuple[Type[BaseSVC], str]"  [list-item]
+ sklearn/svm/tests/test_svm.py:582: error: List item 1 has incompatible type "tuple[type[NuSVC], str]"; expected "tuple[type[BaseSVC], str]"  [list-item]
- sklearn/svm/tests/test_svm.py:601: error: List item 1 has incompatible type "tuple[Type[NuSVC], dict[str, list[float]]]"; expected "tuple[Type[BaseSVC], dict[str, list[float]]]"  [list-item]
+ sklearn/svm/tests/test_svm.py:601: error: List item 1 has incompatible type "tuple[type[NuSVC], dict[str, list[float]]]"; expected "tuple[type[BaseSVC], dict[str, list[float]]]"  [list-item]
- sklearn/svm/tests/test_svm.py:1173: error: List item 0 has incompatible type "Type[SVC]"; expected "Type[BaseSVC]"  [list-item]
+ sklearn/svm/tests/test_svm.py:1173: error: List item 0 has incompatible type "type[SVC]"; expected "type[BaseSVC]"  [list-item]
- sklearn/svm/tests/test_svm.py:1185: error: List item 0 has incompatible type "Type[SVC]"; expected "Type[BaseSVC]"  [list-item]
+ sklearn/svm/tests/test_svm.py:1185: error: List item 0 has incompatible type "type[SVC]"; expected "type[BaseSVC]"  [list-item]
- sklearn/neighbors/tests/test_neighbors.py:287: error: List item 0 has incompatible type "Type[KNeighborsClassifier]"; expected "Type[NeighborsBase]"  [list-item]
+ sklearn/neighbors/tests/test_neighbors.py:287: error: List item 0 has incompatible type "type[KNeighborsClassifier]"; expected "type[NeighborsBase]"  [list-item]
- sklearn/neighbors/tests/test_neighbors.py:288: error: List item 1 has incompatible type "Type[KNeighborsRegressor]"; expected "Type[NeighborsBase]"  [list-item]
+ sklearn/neighbors/tests/test_neighbors.py:288: error: List item 1 has incompatible type "type[KNeighborsRegressor]"; expected "type[NeighborsBase]"  [list-item]
- sklearn/model_selection/tests/test_split.py:377: error: List item 0 has incompatible type "Type[StratifiedKFold]"; expected "Type[_BaseKFold]"  [list-item]
+ sklearn/model_selection/tests/test_split.py:377: error: List item 0 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:404: error: List item 0 has incompatible type "Type[StratifiedKFold]"; expected "Type[_BaseKFold]"  [list-item]
+ sklearn/model_selection/tests/test_split.py:404: error: List item 0 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:443: error: List item 0 has incompatible type "Type[StratifiedKFold]"; expected "Type[_BaseKFold]"  [list-item]
+ sklearn/model_selection/tests/test_split.py:443: error: List item 0 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:486: error: List item 0 has incompatible type "Type[KFold]"; expected "Type[_BaseKFold]"  [list-item]
+ sklearn/model_selection/tests/test_split.py:486: error: List item 0 has incompatible type "type[KFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:486: error: List item 1 has incompatible type "Type[StratifiedKFold]"; expected "Type[_BaseKFold]"  [list-item]
+ sklearn/model_selection/tests/test_split.py:486: error: List item 1 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/linear_model/tests/test_least_angle.py:233: error: List item 0 has incompatible type "Type[Lars]"; expected "Type[Lars]"  [list-item]
+ sklearn/linear_model/tests/test_least_angle.py:233: error: List item 0 has incompatible type "type[Lars]"; expected "type[Lars]"  [list-item]
- sklearn/linear_model/tests/test_least_angle.py:233: error: List item 1 has incompatible type "Type[LarsCV]"; expected "Type[Lars]"  [list-item]
+ sklearn/linear_model/tests/test_least_angle.py:233: error: List item 1 has incompatible type "type[LarsCV]"; expected "type[Lars]"  [list-item]
- sklearn/ensemble/tests/test_weight_boosting.py:600: error: List item 1 has incompatible type "tuple[Type[AdaBoostRegressor], Type[DecisionTreeRegressor]]"; expected "tuple[Type[BaseWeightBoosting], ABCMeta]"  [list-item]
+ sklearn/ensemble/tests/test_weight_boosting.py:600: error: List item 1 has incompatible type "tuple[type[AdaBoostRegressor], type[DecisionTreeRegressor]]"; expected "tuple[type[BaseWeightBoosting], ABCMeta]"  [list-item]
- sklearn/ensemble/tests/test_weight_boosting.py:619: error: List item 0 has incompatible type "Type[AdaBoostClassifier]"; expected "Type[BaseWeightBoosting]"  [list-item]
+ sklearn/ensemble/tests/test_weight_boosting.py:619: error: List item 0 has incompatible type "type[AdaBoostClassifier]"; expected "type[BaseWeightBoosting]"  [list-item]
- sklearn/ensemble/tests/test_stacking.py:553: error: List item 1 has incompatible type "tuple[Type[StackingRegressor], Type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, Type[MultiOutputMixin], str, BaseEstimator, Any, Any]"  [list-item]
+ sklearn/ensemble/tests/test_stacking.py:553: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[MultiOutputMixin], str, BaseEstimator, Any, Any]"  [list-item]
- sklearn/ensemble/tests/test_gradient_boosting.py:1340: error: List item 2 has incompatible type "tuple[Type[GradientBoostingRegressor], Any, Type[DummyRegressor]]"; expected "tuple[ABCMeta, Any, Type[MultiOutputMixin]]"  [list-item]
+ sklearn/ensemble/tests/test_gradient_boosting.py:1340: error: List item 2 has incompatible type "tuple[type[GradientBoostingRegressor], Any, type[DummyRegressor]]"; expected "tuple[ABCMeta, Any, type[MultiOutputMixin]]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:34: error: List item 1 has incompatible type "tuple[Type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[Type[BaseHistGradientBoosting], Any, Any]"  [list-item]
+ sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:34: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:56: error: List item 1 has incompatible type "tuple[Type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[Type[BaseHistGradientBoosting], Any, Any]"  [list-item]
+ sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:56: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:82: error: List item 1 has incompatible type "tuple[Type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[Type[BaseHistGradientBoosting], Any, Any]"  [list-item]
+ sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:82: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:110: error: List item 1 has incompatible type "tuple[Type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[Type[BaseHistGradientBoosting], Any, Any]"  [list-item]
+ sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:110: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:139: error: List item 1 has incompatible type "tuple[Type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[Type[BaseHistGradientBoosting], Any, Any]"  [list-item]
+ sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:139: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:159: error: List item 1 has incompatible type "tuple[Type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[Type[BaseHistGradientBoosting], Any, Any]"  [list-item]
+ sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:159: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]

... (truncated 333 lines) ...```

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great!

@hauntsaninja hauntsaninja merged commit bf6b21d into python:master Apr 26, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency in use builtin.type and typing.Type in error messages
2 participants