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

Replace list with Sequence #3654

Merged
merged 3 commits into from
Oct 14, 2024
Merged

Replace list with Sequence #3654

merged 3 commits into from
Oct 14, 2024

Conversation

KuuCi
Copy link
Contributor

@KuuCi KuuCi commented Oct 14, 2024

What does this PR do?

This PR is to replace some of the type checking. Currently, If we have RandomClass(BaseClass), if we have pyright check for list[BaseClass], it will throw a pyright error if user is passing in list[RandomClass]. Instead, we should replace with Sequence[BaseClass]
microsoft/pyright#130

Specifically in our case, if we were to make a wrapper around torchmetrics.Metrics, a pyright error will be thrown because it will expect list[Metrics], instead of whatever class is inheriting torchmetrics.Metrics

@KuuCi KuuCi requested a review from a team as a code owner October 14, 2024 19:59
@KuuCi KuuCi requested review from irenedea and mvpatel2000 October 14, 2024 19:59
Copy link
Contributor

@irenedea irenedea left a comment

Choose a reason for hiding this comment

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

lgtm! Thank you!

@KuuCi KuuCi merged commit 6ca3936 into main Oct 14, 2024
14 checks passed
@KuuCi KuuCi deleted the type_check_sequence branch October 14, 2024 20:48
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