Skip to content

Commit 0d1592a

Browse files
committed
Fix mypy error by conditionally setting plot_node["chart-var-name"] only when option is present
- The original `**{"chart-var-name": ...}` likely existed because chart-var-name contains a hyphen, so it cannot be passed as a normal keyword argument. - New behavior: create node first, then only set plot_node["chart-var-name"] when user provided that option. - Downstream code uses node.get("chart-var-name", None), so behavior is effectively the same for runtime logic.
1 parent 3b6423a commit 0d1592a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sphinxext_altair/altairplot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ def run(self) -> list[nodes.Element]:
212212
links=self.options.get("links", app.builder.config.altairplot_links),
213213
output=self.options.get("output", "plot"),
214214
strict="strict" in self.options,
215-
**{"chart-var-name": self.options.get("chart-var-name", None)},
216215
)
216+
if "chart-var-name" in self.options:
217+
plot_node["chart-var-name"] = self.options["chart-var-name"]
217218
if "alt" in self.options:
218219
plot_node["alt"] = self.options["alt"]
219220

0 commit comments

Comments
 (0)