KEMBAR78
Show closest candidates for misspellings : keyword argument case by Wuisch · Pull Request #7888 · python/mypy · GitHub
Skip to content

Conversation

Wuisch
Copy link
Contributor

@Wuisch Wuisch commented Nov 5, 2019

This fixes the following case outlined in #824

def f(other: A) -> None: pass
f(otter: A())

Unexpected keyword argument "otter" for "f"
is now
Unexpected keyword argument "otter" for "f"; did you mean "other"?

Copy link
Member

@ilevkivskyi ilevkivskyi 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 very good. I have just couple minor comments.

[case testKeywordMisspellingFloatInt]
def f(atter: float, btter: int) -> None: pass # N: "f" defined here
x: int = 5
f(otter=x) # E: Unexpected keyword argument "otter" for "f"; did you mean "btter" or "atter"?
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add a test or two involving *args to be sure they don't interfere with the logic?

Copy link
Contributor Author

@Wuisch Wuisch Nov 6, 2019

Choose a reason for hiding this comment

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

Good catch!
Added some tests.
And the *args did interfere with the logic. --> improved logic

Add tests for *args
Fix bugs with *args
Remove redundant type check
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Thanks for updates, this looks almost ready, just two more style comments.

style improvements
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Thanks for updates, LGTM!

@ilevkivskyi ilevkivskyi merged commit 8252a0b into python:master Nov 7, 2019
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