Skip to content

Add function signature hooks for dataclasses functions: replace, asdict, astuple #5152

Open
@ilevkivskyi

Description

@ilevkivskyi

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions