From a6853a94500db237ec52964b122f2394972451ca Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Fri, 15 Nov 2024 07:59:24 -0500 Subject: [PATCH] cast --- altair/utils/_vegafusion_data.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/altair/utils/_vegafusion_data.py b/altair/utils/_vegafusion_data.py index ed1ca7024..876cfc569 100644 --- a/altair/utils/_vegafusion_data.py +++ b/altair/utils/_vegafusion_data.py @@ -2,7 +2,7 @@ import uuid from importlib.metadata import version as importlib_version -from typing import TYPE_CHECKING, Any, Callable, Final, TypedDict, Union, overload +from typing import TYPE_CHECKING, Any, Callable, Final, TypedDict, Union, cast, overload from weakref import WeakValueDictionary import narwhals.stable.v1 as nw @@ -29,7 +29,7 @@ # from charts by the vegafusion data transformer. Use a WeakValueDictionary # rather than a dict so that the Python interpreter is free to garbage # collect the stored DataFrames. -extracted_inline_tables: MutableMapping[str, Any] = WeakValueDictionary() +extracted_inline_tables: MutableMapping[str, DataFrameLike] = WeakValueDictionary() # Special URL prefix that VegaFusion uses to denote that a # dataset in a Vega spec corresponds to an entry in the `inline_datasets` @@ -85,7 +85,7 @@ def vegafusion_data_transformer( if supported_by_vf and not isinstance(data, SupportsGeoInterface): table_name = f"table_{uuid.uuid4()}".replace("-", "_") - extracted_inline_tables[table_name] = data + extracted_inline_tables[table_name] = cast(DataFrameLike, data) return {"url": VEGAFUSION_PREFIX + table_name} else: # Use default transformer for geo interface objects