8000 Predict enum value type for unknown member names. by mgilson · Pull Request #9443 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Predict enum value type for unknown member names. #9443

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 13 commits into from
Sep 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change a ValueError to an assert for type collapsing.
  • Loading branch information
mgilson-argo committed Sep 17, 2020
commit aae9de37a29e44d1e5dd965a6bfcd223624bf45e
3 changes: 1 addition & 2 deletions mypy/plugins/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def _infer_value_type_with_auto_fallback(
if not (isinstance(proper_type, Instance) or
Copy link
Member

Choose a reason for hiding this comment

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

and!

proper_type.type.fullname != 'enum.auto'):
return proper_type
if not isinstance(ctx.type, Instance):
raise ValueError("An incorrect ctx.type was passed.")
assert isinstance(ctx.type, Instance), 'An incorrect ctx.type was passed.'
info = ctx.type.type
# Find the first _generate_next_value_ on the mro. We need to know
# if it is `Enum` because `Enum` types say that the return-value of
Expand Down
0