Task pre attribute is wrongly types
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
Research direction
The report centers on Task.pre and the @task decorator in invoke.tasks; start by locating their type declarations and reproduce the shown type-checking error. Update the relevant type information so the runtime pre value is represented accurately, then rerun the example and confirm the comparison-overlap error is gone.
Written by the indexing model from the issue text.
Description
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,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 412
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pyinvoke/invoke
-
[Security] Shell injection via Context.cd() path argument — metacharacters not escaped (CWE-78) Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
open-webui/open-webui#30750 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100