Skip to content

DslBase.__init__() typing won't accept dict unpacking #1896

Open
@realsuayip

Description

@realsuayip

DslBase.__init__() typing does not accept dict unpacking, hence all Query subclasses.

def __init__(self, _expand__to_dot: Optional[bool] = None, **params: Any) -> None:

For example, Term(**my_dict) will result in following mypy error:

error: Argument 1 to "Term" has incompatible type "**Dict[str, str]"; expected "Optional[bool]

This is due to _expand__to_dot, mypy assumes all params have unified type. Maybe just use **params: Any and pop _expand__to_dot from there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions