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

Y011 now ignores sentinel values #415

Merged
merged 1 commit into from
Aug 16, 2023
Merged

Y011 now ignores sentinel values #415

merged 1 commit into from
Aug 16, 2023

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Aug 15, 2023

No description provided.

@srittau
Copy link
Collaborator Author

srittau commented Aug 15, 2023

Depends on python/typeshed#10582.

@github-actions
Copy link

This change has no effect on typeshed. 🤖🎉

}
)

_ALLOWED_SIMPLE_ATTRIBUTES_IN_DEFAULTS = frozenset({"sentinel"})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't love this, since sentinel is a pretty common variable name, and it could be imported from other places. But I also understand that forcing people to use _typeshed.sentinel everywhere would be annoyingly verbose, so I'm fine with it for now.

It's on my to-do list to teach flake8-pyi about how imports work, so that we'd be able to figure out whether sentinel had actually been imported from _typeshed or not. But it'll involve a fair bit of refactoring to do that...

Copy link
Collaborator Author

@srittau srittau Aug 15, 2023

Choose a reason for hiding this comment

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

Indeed, proper resolving would be great as it would also allow constructs like from _typeshed import sentinel as _sentinel. (Edit: Of course ideally, the linter would provide this information to its plugins.)

@srittau srittau marked this pull request as ready for review August 16, 2023 09:31
@srittau srittau merged commit ed8ff07 into PyCQA:main Aug 16, 2023
19 checks passed
@srittau srittau deleted the sentinel branch August 16, 2023 09:32
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.

2 participants