Add function signature hooks for dataclasses functions: replace, asdict, astuple
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by locating the existing dataclass creation support and the typeshed definitions for replace, asdict, and astuple. Determine how the plugin can provide more precise signatures, including a possible TypedDict return for asdict. Done means these functions no longer rely on the broad signatures described in the issue and their inferred types are covered by tests.
Written by the indexing model from the issue text.
Description
Currently, the plugin only supports dataclass creation (i.e. generation of dunder methods with correct types, including __init__). However, some functions in the dataclass modules have quite broad types in typeshed, for example:
def replace(obj: _T, **changes: Any) -> _T: ...
so that arbitrary arguments can be give for changes, etc. The plugin should be able to give more precise type for these functions. In particular, asdict could return a TypedDict.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 54
Contributor guide
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 python/mypy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug topic-configuration topic-error-reporting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100