rapidsai / dependency-file-generator

https://pypi.org/project/rapids-dependency-file-generator/
Apache License 2.0
15 stars 13 forks source link

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

Closed jameslamb closed 3 months ago

jameslamb commented 3 months ago

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)

GPUtester commented 3 months ago

:tada: This PR is included in version 1.13.10 :tada:

The release is available on:

Your semantic-release bot :package::rocket: