Skip to content

Commit

Permalink
fix(typing): Satisfy mypy on utils.core.update_nested
Browse files Browse the repository at this point in the history
This is due to a `TypedDict` being typed as `Mapping` instead of `MutableMapping` (like `dict`).
At runtime it is a `dict`, so I'm not making any runtime changes - this will have to do
  • Loading branch information
dangotbanned committed Sep 13, 2024
1 parent 79fb2fb commit c8ccb05
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,21 @@ def decorate(cb: WrapsFunc[R], /) -> WrappedMethod[T, P, R] | WrappedFunc[P, R]:
return decorate


@overload
def update_nested(
original: t.MutableMapping[Any, Any],
update: t.Mapping[Any, Any],
copy: Literal[False] = ...,
) -> t.MutableMapping[Any, Any]: ...
@overload
def update_nested(
original: t.Mapping[Any, Any],
update: t.Mapping[Any, Any],
copy: Literal[True],
) -> t.MutableMapping[Any, Any]: ...
def update_nested(
original: Any,
update: t.Mapping[Any, Any],
copy: bool = False,
) -> t.MutableMapping[Any, Any]:
"""
Expand Down

0 comments on commit c8ccb05

Please sign in to comment.