Skip to content

Improve several error codes so attribute access of names is recognised #161

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

Merged
merged 10 commits into from
Jan 29, 2022

Conversation

AlexWaygood
Copy link
Collaborator

Several error codes had issues due to the fact that the plugin hardcoded names such as Literal or Union into the logic, but did not consider that a user might access these names via attribute access, e.g. typing_extensions.Literal or typing.Union. For example, the plugin recognised X: TypeAlias = int as a valid type alias, but did not recognise X: typing.TypeAlias = int as a valid type alias. It's not standard "typeshed style" to access names in that way, but it's nonetheless valid, so we should probably account for that possibility.

This PR fixes these bugs.

Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks! Could you add a changelog entry?

@AlexWaygood
Copy link
Collaborator Author

Thanks! Could you add a changelog entry?

Sure

AlexWaygood added a commit to AlexWaygood/typeshed that referenced this pull request Jan 29, 2022
@AlexWaygood
Copy link
Collaborator Author

typeshed PR here: python/typeshed#7079

@AlexWaygood
Copy link
Collaborator Author

Thanks! Could you add a changelog entry?

Done :)

Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Great!

JelleZijlstra pushed a commit to python/typeshed that referenced this pull request Jan 29, 2022
@AlexWaygood AlexWaygood reopened this Jan 29, 2022
@AlexWaygood AlexWaygood merged commit 25ea476 into PyCQA:master Jan 29, 2022
@AlexWaygood AlexWaygood deleted the attributes branch January 29, 2022 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants