From c8ccb0519ad4e7d25381703e959aafda5fb6e4c6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:37:09 +0100 Subject: [PATCH] fix(typing): Satisfy `mypy` on `utils.core.update_nested` 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 --- altair/utils/core.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/altair/utils/core.py b/altair/utils/core.py index 7e8340324..0af95c49f 100644 --- a/altair/utils/core.py +++ b/altair/utils/core.py @@ -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]: """