Closed jameslamb closed 3 months ago
Contributes to #87.
Fixes the return type hint for grid(), which fixes this error reported by mypy:
grid()
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.
[..., None, None]
Generator
From the typing docs:
typing
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]: ...
A generator can be annotated by the generic type Generator[YieldType, SendType, ReturnType].
Generator[YieldType, SendType, ReturnType]
If your generator will only yield values, set the SendType and ReturnType to None:
SendType
ReturnType
None
def infinite_stream(start: int) -> Generator[int, None, None]: ...
def infinite_stream(start: int) -> Generator[int, None, None]:
...
(docs link)
:tada: This PR is included in version 1.13.10 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Contributes to #87.
Fixes the return type hint for
grid()
, which fixes this error reported bymypy
: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 theGenerator
hint?From the
typing
docs:(docs link)