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

Move final detection for Enum in checker.py #11984

Merged
merged 6 commits into from
Jan 18, 2022
Merged

Move final detection for Enum in checker.py #11984

merged 6 commits into from
Jan 18, 2022

Conversation

sobolevn
Copy link
Member

Changes:

  • I've moved all final detection logic from semanal.py to checker.py. Why? Because we need type checking! For example, methods, properties, and other descriptors are not counted as Enum membres
  • We don't modify .is_final anymore. Why? It is too disruptive. Now this is a special-case for Enum only

Closes #11850

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks, looks good! It makes sense to do these checks during type checking. Left a few nits; feel to merge when you've addressed them (and fixed the merge conflict).

mypy/util.py Outdated Show resolved Hide resolved
test-data/unit/check-enum.test Show resolved Hide resolved
@sobolevn
Copy link
Member Author

sobolevn commented Jan 18, 2022

Fixed merge conflicts, rebased, waiting for the CI to pass and merging 🎉

@sobolevn
Copy link
Member Author

@JukkaL I am going to use these guidelines for merging process: https://github.com/python/mypy/blob/master/CONTRIBUTING.md#core-developer-guidelines

@sobolevn sobolevn merged commit 0a03ba0 into python:master Jan 18, 2022
@sobolevn
Copy link
Member Author

Done! My first merged PR 🎉

@JelleZijlstra
Copy link
Member

Congratulations!

tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
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.

0.930 still gives me "inheriting final" error with an enum.Flag subclass
3 participants