Skip to content

Conversation

@zliang-akamai
Copy link
Member

📝 Description

This is to fix a type annotation. The return type of the function with @contextlib.contextmanager decorator will be handle by the decorator and annotated as the appropriate context manager type. Marking the return type of the inner function (the function under the decorator) is considered as an invalid type because the inner function never return a context manager but a generator (Generator[TextIOWrapper[_WrappedBuffer] | HTTPResponse | Any, Any, None] ), which is also automatically detected by Python.

✔️ How to Test

mypy linodecli/cli.py
Will return less errors than before. (And yes, it still returns tons of error (¬_¬"))

@zliang-akamai zliang-akamai added the improvement for improvements in existing functionality in the changelog. label Aug 8, 2025
@zliang-akamai zliang-akamai requested a review from a team as a code owner August 8, 2025 05:56
@zliang-akamai zliang-akamai requested review from ezilber-akamai and yec-akamai and removed request for a team August 8, 2025 05:56
Copy link
Contributor

@yec-akamai yec-akamai 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 fixing it!

@zliang-akamai zliang-akamai merged commit b7a92c4 into linode:dev Sep 23, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement for improvements in existing functionality in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants