https://prefect.io logo
Title
j

José Duarte

08/24/2022, 7:55 AM
Is there a particular reason why the prefect codebase uses the type pattern
value: NonNullableType = None
? I understand the motivation behind it but in the end, the type is wrong and mypy will complain. Is there a setting for mypy I am missing?
1
j

Jeremiah

08/24/2022, 10:06 PM
Hi @José Duarte — that syntax is currently valid for mypy, it infers that the
NonNullableType
is actually
Optional[NonNullableType]
. Perhaps you are running mypy with the
--no-implicit-optional
flag, which disables this type of inference? (docs). Interestingly, mypy is currently evaluating a two-year-old proposal to make
-noo-implicit-optional
the default, but it has not been done yet AFAIK
👍 2