Skip to content

Commit 9002472

Browse files
authored
1 parent 922eac3 commit 9002472

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

altair/utils/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def to_list_if_array(val):
383383
# We know that the column names are strings from the isinstance check
384384
# further above but mypy thinks it is of type Hashable and therefore does not
385385
# let us assign it to the col_name variable which is already of type str.
386-
col_name = cast(str, dtype_item[0])
386+
col_name = cast("str", dtype_item[0])
387387
dtype = dtype_item[1]
388388
dtype_name = str(dtype)
389389
if dtype_name == "category":

altair/utils/mimebundle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def spec_to_mimebundle(
140140
if format in {"png", "svg", "pdf", "vega"}:
141141
return _spec_to_mimebundle_with_engine(
142142
spec,
143-
cast(Literal["png", "svg", "pdf", "vega"], format),
143+
cast("Literal['png', 'svg', 'pdf', 'vega']", format),
144144
internal_mode,
145145
engine=engine,
146146
format_locale=embed_options.get("formatLocale", None),

altair/utils/plugin_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def __init__(
134134
f"https://docs.astral.sh/ruff/rules/assert/"
135135
)
136136
deprecated_warn(msg, version="5.4.0")
137-
self.plugin_type = cast(IsPlugin, _is_type(plugin_type))
137+
self.plugin_type = cast("IsPlugin", _is_type(plugin_type))
138138
else:
139139
self.plugin_type = plugin_type
140140
self._active: Plugin[R] | None = None
@@ -214,7 +214,7 @@ def _enable(self, name: str, **options) -> None:
214214
raise ValueError(self.entrypoint_err_messages[name]) from err
215215
else:
216216
raise NoSuchEntryPoint(self.entry_point_group, name) from err
217-
value = cast(PluginT, ep.load())
217+
value = cast("PluginT", ep.load())
218218
self.register(name, value)
219219
self._active_name = name
220220
self._active = self._plugins[name]

altair/vegalite/v5/api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def _parse_when_compose(
798798
if constraints:
799799
iters.append(_parse_when_constraints(constraints))
800800
r = functools.reduce(operator.and_, itertools.chain.from_iterable(iters))
801-
return t.cast(_expr_core.BinaryExpression, r)
801+
return t.cast("_expr_core.BinaryExpression", r)
802802

803803

804804
def _parse_when(
@@ -1107,7 +1107,7 @@ def when(
11071107
conditions = self.to_dict()
11081108
current = conditions["condition"]
11091109
if isinstance(current, list):
1110-
conditions = t.cast(_Conditional[_Conditions], conditions)
1110+
conditions = t.cast("_Conditional[_Conditions]", conditions)
11111111
return ChainedWhen(condition, conditions)
11121112
elif isinstance(current, dict):
11131113
cond = _reveal_parsed_shorthand(current)
@@ -1384,7 +1384,7 @@ def param(
13841384
parameter.empty = empty
13851385
elif empty in empty_remap:
13861386
utils.deprecated_warn(warn_msg, version="5.0.0")
1387-
parameter.empty = empty_remap[t.cast(str, empty)]
1387+
parameter.empty = empty_remap[t.cast("str", empty)]
13881388
else:
13891389
raise ValueError(warn_msg)
13901390

@@ -3086,7 +3086,7 @@ def transform_filter(
30863086
verbose_composition = chart.transform_filter((datum.year == 2000) & (datum.sex == 1))
30873087
chart.transform_filter(year=2000, sex=1)
30883088
"""
3089-
if depr_filter := t.cast(Any, constraints.pop("filter", None)):
3089+
if depr_filter := t.cast("Any", constraints.pop("filter", None)):
30903090
utils.deprecated_warn(
30913091
"Passing `filter` as a keyword is ambiguous.\n\n"
30923092
"Use a positional argument for `<5.5.0` behavior.\n"
@@ -3986,7 +3986,7 @@ def from_dict(
39863986
pass
39873987

39883988
# As a last resort, try using the Root vegalite object
3989-
return t.cast(_TSchemaBase, core.Root.from_dict(dct, validate))
3989+
return t.cast("_TSchemaBase", core.Root.from_dict(dct, validate))
39903990

39913991
def to_dict(
39923992
self,

0 commit comments

Comments
 (0)