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

fix: fix return type hint for grid(), add a few others #94

Merged
merged 6 commits into from
May 16, 2024

Conversation

jameslamb
Copy link
Member

Contributes to #87.

Fixes the return type hint for grid(), which fixes this error reported by mypy:

src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py:71: error: "Generator" expects 3 type arguments, but 1 given  [type-arg]

Also adds a few return type hints for places that were missing them, to improve the ability of type checkers to inspect the code.

Notes for Reviewers

What is this [..., None, None] in the Generator hint?

From the typing docs:

A generator can be annotated by the generic type Generator[YieldType, SendType, ReturnType].

If your generator will only yield values, set the SendType and ReturnType to None:

def infinite_stream(start: int) -> Generator[int, None, None]:
...

(docs link)

@jameslamb jameslamb added bug Something isn't working non-breaking Introduces a non-breaking change labels May 14, 2024
@jameslamb jameslamb mentioned this pull request May 15, 2024
@jameslamb jameslamb merged commit bf0ac9b into rapidsai:main May 16, 2024
4 checks passed
@jameslamb jameslamb deleted the mypy/return-type-hints branch May 16, 2024 14:03
GPUtester pushed a commit that referenced this pull request May 16, 2024
## [1.13.10](v1.13.9...v1.13.10) (2024-05-16)

### Bug Fixes

* fix return type hint for grid(), add a few others ([#94](#94)) ([bf0ac9b](bf0ac9b))
@GPUtester
Copy link

🎉 This PR is included in version 1.13.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

difyrrwrzd added a commit to difyrrwrzd/dependency-file-generator that referenced this pull request Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working non-breaking Introduces a non-breaking change released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants