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

Provide overload type hints for search_issues variants #1861

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Stealthii
Copy link
Contributor

@Stealthii Stealthii commented May 22, 2024

search_issues can return either a dictionary (if json_result) or a list of Issues under default behavior.

This change provides separate hints using overload so that type checked code doesn't need to cast unnecessarily when dealing with output.

Tests have been added, and cases where casting was used have been removed.

Fixes #1608.

search_issues can return either a dictionary (if json_result) or a list
of Issues under default behavior. This change provides separate hints
using overload so that type checked code doesn't need to cast
unnecessarily when dealing with output.
We now require json_result and use_post are passed as keyword arguments,
satisfying type checker requirements and handling the default return
value correctly.
As the correct type hint is now provided, this is no longer necessary.
@Stealthii Stealthii changed the title Correct type hints for search_issues Provide overload type hints for search_issues variants May 22, 2024
@Stealthii Stealthii marked this pull request as ready for review May 23, 2024 07:58
@Stealthii
Copy link
Contributor Author

The cloud / py3.8 job seems to be failing for all PRs, unrelated to the changes provided here.

@filbranden
Copy link

Looks awesome! Would be nice if this was merged, I run into issues having to cast this every time I use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants