from typing import cast, Any
from invoke.context import Context
from invoke.tasks import Task, task
@task()
def bar(context: Context) -> None:
pass
@task(bar)
def foo(context: Context) -> None:
pass
assert cast(Task[Any], foo).pre == (bar,)
The code works during runtime, but during type checking it fails with
x.py:17:8: error: Non-overlapping equality check (left operand type: "list[str] | str", right operand type: "tuple[Any]") [comparison-overlap]
assert cast(Task[Any], foo).pre == (bar,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The code works during runtime, but during type checking it fails with