Run enum.Enum analysis on non-assigned calls#20267
Open
A5rocks wants to merge 1 commit intopython:masterfrom
Open
Run enum.Enum analysis on non-assigned calls#20267A5rocks wants to merge 1 commit intopython:masterfrom
A5rocks wants to merge 1 commit intopython:masterfrom
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/types/enum.py:175: error: Enum() expects a string literal as the first argument [misc]
|
Collaborator
Author
|
I think that error is fine. It's not clear whether we should error or not, but e.g. I can imagine a world where the returned Enum has to match a protocol (e.g. "has attribute (maybe others have different opinions?) |
Collaborator
I think the message could be worded a bit differently to clarify that this is a mypy limitation and not a runtime requirement, but the presence of this error is definitely fine - there should be some limits when we just say "nah, sorry, don't know what you mean here" and bail out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #20266
semanal_enum.pygenerally feels kinda strange, likeprocess_enum_callfeels redundant? The only thing it adds over simply makingsemanaldocheck_enum_callis... check that we aren't assigning to a property or a tuple. I feel like we could separate that and make it somewhat nicer.I did the minimal thing though, so I did not refactor things.