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

gh-104050: Argument Clinic: Annotate output_templates() #106732

Merged

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jul 13, 2023

@AlexWaygood
Copy link
Member

AlexWaygood commented Jul 13, 2023

The mypy error might indicate we have the wrong annotation for Parameter.converter

Edit: no, don't think that's the issue actually

@erlend-aasland
Copy link
Contributor Author

Thanks for 6891e14! The last error puzzles me, though, and I have no bandwidth for this today; if you find a solution, feel free to land this :)

@AlexWaygood
Copy link
Member

The last error puzzles me, though, and I have no bandwidth for this today; if you find a solution, feel free to land this

Yeah, I can't immediately tell what the issue is here. I'm investigating :)

Mypy doesn't have a great understanding of multiple inheritance, so this may be a false positive. But not sure.

@erlend-aasland
Copy link
Contributor Author

Aaah, perhaps it is line 801 and 802:

assert isinstance(parameters[0].converter, self_converter)
del parameters[0]

My guess: mypy uses only the information provided in line 801, but is not smart enough to see that line 802 invalidates that assert, so it continues to think parameters[0] is asserted as a self_converter instance.

@AlexWaygood
Copy link
Member

Aaah, perhaps it is line 801 and 802:

assert isinstance(parameters[0].converter, self_converter)
del parameters[0]

My guess: mypy uses only the information provided in line 801, but is not smart enough to see that line 802 invalidates that assert, so it continues to think parameters[0] is asserted as a self_converter instance.

Bingo! I'll push a fix.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jul 14, 2023

Does f9cb537 look good to you?

@erlend-aasland erlend-aasland marked this pull request as ready for review July 14, 2023 11:44
@erlend-aasland
Copy link
Contributor Author

Does f9cb537 look good to you?

Neat!

@AlexWaygood
Copy link
Member

Thanks!

@AlexWaygood AlexWaygood enabled auto-merge (squash) July 14, 2023 11:47
@AlexWaygood AlexWaygood merged commit 7c95345 into python:main Jul 14, 2023
19 checks passed
@erlend-aasland erlend-aasland deleted the clinic/annotate-output-templates branch July 14, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants