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

Use a dedicated error code for abstract type object type error #13785

Merged
merged 1 commit into from
Oct 1, 2022

Conversation

ilevkivskyi
Copy link
Member

Ref #4717

This will allow people who consider this check too strict to opt-out easily using --disable-error-code=type-abstract.

@github-actions
Copy link
Contributor

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

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/permissions.py:167: error: Only concrete class can be given where "Type[AsyncCache[Union[Snowflake, int], GuildChannel]]" is expected  [misc]
+ tanjun/permissions.py:167: error: Only concrete class can be given where "Type[AsyncCache[Union[Snowflake, int], GuildChannel]]" is expected  [type-abstract]
- tanjun/permissions.py:222: error: Only concrete class can be given where "Type[AsyncCache[Union[Snowflake, int], Guild]]" is expected  [misc]
+ tanjun/permissions.py:222: error: Only concrete class can be given where "Type[AsyncCache[Union[Snowflake, int], Guild]]" is expected  [type-abstract]
- tanjun/permissions.py:241: error: Only concrete class can be given where "Type[GuildBoundCache[Union[Snowflake, int], Role]]" is expected  [misc]
+ tanjun/permissions.py:241: error: Only concrete class can be given where "Type[GuildBoundCache[Union[Snowflake, int], Role]]" is expected  [type-abstract]
- tanjun/permissions.py:335: error: Only concrete class can be given where "Type[AsyncCache[Union[Snowflake, int], Role]]" is expected  [misc]
+ tanjun/permissions.py:335: error: Only concrete class can be given where "Type[AsyncCache[Union[Snowflake, int], Role]]" is expected  [type-abstract]
- tanjun/dependencies/owners.py:172: error: Only concrete class can be given where "Type[SingleStoreCache[Application]]" is expected  [misc]
+ tanjun/dependencies/owners.py:172: error: Only concrete class can be given where "Type[SingleStoreCache[Application]]" is expected  [type-abstract]
- tanjun/dependencies/limiters.py:513: error: Only concrete class can be given where "Type[AbstractCooldownManager]" is expected  [misc]
+ tanjun/dependencies/limiters.py:513: error: Only concrete class can be given where "Type[AbstractCooldownManager]" is expected  [type-abstract]
- tanjun/dependencies/limiters.py:865: error: Only concrete class can be given where "Type[AbstractConcurrencyLimiter]" is expected  [misc]
+ tanjun/dependencies/limiters.py:865: error: Only concrete class can be given where "Type[AbstractConcurrencyLimiter]" is expected  [type-abstract]
- tanjun/dependencies/__init__.py:112: error: Only concrete class can be given where "Type[AbstractOwners]" is expected  [misc]
+ tanjun/dependencies/__init__.py:112: error: Only concrete class can be given where "Type[AbstractOwners]" is expected  [type-abstract]
- tanjun/clients.py:754: error: Only concrete class can be given where "Type[Client]" is expected  [misc]
+ tanjun/clients.py:754: error: Only concrete class can be given where "Type[Client]" is expected  [type-abstract]
- tanjun/clients.py:757: error: Only concrete class can be given where "Type[RESTClient]" is expected  [misc]
+ tanjun/clients.py:757: error: Only concrete class can be given where "Type[RESTClient]" is expected  [type-abstract]
- tanjun/clients.py:759: error: Only concrete class can be given where "Type[Cache]" is expected  [misc]
+ tanjun/clients.py:759: error: Only concrete class can be given where "Type[Cache]" is expected  [type-abstract]
- tanjun/clients.py:761: error: Only concrete class can be given where "Type[EventManager]" is expected  [misc]
+ tanjun/clients.py:761: error: Only concrete class can be given where "Type[EventManager]" is expected  [type-abstract]
- tanjun/clients.py:763: error: Only concrete class can be given where "Type[InteractionServer]" is expected  [misc]
+ tanjun/clients.py:763: error: Only concrete class can be given where "Type[InteractionServer]" is expected  [type-abstract]
- tanjun/clients.py:765: error: Only concrete class can be given where "Type[ShardAware]" is expected  [misc]
+ tanjun/clients.py:765: error: Only concrete class can be given where "Type[ShardAware]" is expected  [type-abstract]
- tanjun/clients.py:767: error: Only concrete class can be given where "Type[VoiceComponent]" is expected  [misc]
+ tanjun/clients.py:767: error: Only concrete class can be given where "Type[VoiceComponent]" is expected  [type-abstract]
- tanjun/clients.py:2247: error: Only concrete class can be given where "Type[SingleStoreCache[OwnUser]]" is expected  [misc]
+ tanjun/clients.py:2247: error: Only concrete class can be given where "Type[SingleStoreCache[OwnUser]]" is expected  [type-abstract]
- tanjun/clients.py:2296: error: Only concrete class can be given where "Type[SingleStoreCache[Application]]" is expected  [misc]
+ tanjun/clients.py:2296: error: Only concrete class can be given where "Type[SingleStoreCache[Application]]" is expected  [type-abstract]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/packaging/base.py:61: error: Only concrete class can be given where "Type[PackageManifest]" is expected  [misc]
+ src/prefect/packaging/base.py:61: error: Only concrete class can be given where "Type[PackageManifest]" is expected  [type-abstract]

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/types/generic.py:460: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/generic.py:460: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/generic.py:463: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/generic.py:463: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/generic.py:466: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/generic.py:466: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/generic.py:469: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/generic.py:469: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/generic.py:472: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/generic.py:472: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/generic.py:475: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/generic.py:475: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:207: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:207: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:225: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:225: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:243: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:243: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:280: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:280: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:302: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:302: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:324: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:324: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:376: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:376: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:399: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:399: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:422: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:422: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:506: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:506: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:515: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:515: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:524: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:524: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:533: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:533: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/temporal.py:542: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/temporal.py:542: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/strings.py:808: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/strings.py:808: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:212: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:212: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:218: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:218: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:224: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:224: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:230: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:230: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:244: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:244: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:253: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:253: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:262: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:262: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:268: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:268: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:274: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:274: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:280: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:280: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:287: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:287: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:673: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:673: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:681: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:681: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:689: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:689: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:697: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:697: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:705: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:705: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:711: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:711: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/numeric.py:719: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/numeric.py:719: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/logical.py:51: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/logical.py:51: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/logical.py:56: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/logical.py:56: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]
- ibis/expr/types/logical.py:61: error: Only concrete class can be given where "Type[Binary]" is expected  [misc]
+ ibis/expr/types/logical.py:61: error: Only concrete class can be given where "Type[Binary]" is expected  [type-abstract]

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

👍

@ilevkivskyi ilevkivskyi merged commit 8345d22 into python:master Oct 1, 2022
@ilevkivskyi ilevkivskyi deleted the abs-error-code branch October 1, 2022 14:52
@ZhiliangWu
Copy link

@ilevkivskyi Thanks for the updated error code. It seems not to be available in the 0.982 yet. Will it be added to 0.983?

@ilevkivskyi
Copy link
Member Author

There will be no 0.983, next release is 0.990, see #13871 (and yes, this will be included)

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.

3 participants