Alessandro De Rose
05/21/2023, 10:22 AMmypy
is complaining when attempting to unpack a tuple returned from a task. In the example below, when attempting to unpack a
& b
from the call to get_numbers
, mypy
raises the error "None" object is not iterable
. However, the type definition for the get_numbers
function shows that None
should never be returned from the task.
Any idea what's wrong here? (Prefect v2.10.10, mypy v1.3.0)
from prefect import flow, task
@task
def get_numbers(a: int, b: int) -> tuple[int, int]:
return a, b
@flow
def get_numbers_flow() -> None:
a, b = get_numbers(1, 2) # <- "None" object is not iterable.
Tim Galvin
05/22/2023, 1:10 AM@task
decorator. mypy
mightt be type checking against what is now a wrapped function - wrapped via the task
decorator. I am not too sure what can be done about this.
If you use get_numbers.submitt(1,2)
do you get a similar warning?Alessandro De Rose
05/22/2023, 7:55 AM"None" has no attribute "submit"
from mypy
.