Skip to content

feat/fix: improve typehinting of wait_fors #1694

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No 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? No Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

AstreaTSS
Copy link
Member

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

This PR improves typehintings for the wait_for functions, largely by using plenty of overloads. It also fixes some incorrect typehints along the way.

Changes

  • For wait_for, make event: Union[str, "BaseEvent"] > event: Union[str, "type[BaseEvent]"].
  • Add overloads for wait_for to let the typehinter return the type of event passed in if an event type is passed at any point.
  • Add overloads for wait_for_component to enforce either passing messages or components.

Related Issues

Test Scenarios

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files (I'm facing issues with this check running in certain contexts, I'll let the bot take care of it)
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

@silasary silasary merged commit 545f9e2 into interactions-py:unstable Jun 20, 2024
2 checks passed
No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants