|
5 | 5 | from __future__ import annotations |
6 | 6 |
|
7 | 7 | import copy |
8 | | -from typing import TYPE_CHECKING |
| 8 | +from typing import TYPE_CHECKING, Any |
9 | 9 |
|
10 | 10 | if TYPE_CHECKING: |
11 | 11 | from collections.abc import Iterator |
12 | 12 |
|
13 | 13 | import plotly.graph_objects as go |
14 | 14 |
|
15 | 15 |
|
16 | | -def _iter_all_traces(fig: go.Figure) -> Iterator: |
| 16 | +def _iter_all_traces(fig: go.Figure) -> Iterator[Any]: |
17 | 17 | """Iterate over all traces in a figure, including animation frames. |
18 | 18 |
|
19 | 19 | Yields traces from fig.data first, then from each frame in fig.frames. |
@@ -107,7 +107,7 @@ def _merge_frames( |
107 | 107 | overlays: list[go.Figure], |
108 | 108 | base_trace_count: int, |
109 | 109 | overlay_trace_counts: list[int], |
110 | | -) -> list: |
| 110 | +) -> list[go.Frame]: |
111 | 111 | """Merge animation frames from base and overlay figures. |
112 | 112 |
|
113 | 113 | Args: |
@@ -360,7 +360,7 @@ def _merge_secondary_y_frames( |
360 | 360 | base: go.Figure, |
361 | 361 | secondary: go.Figure, |
362 | 362 | y_mapping: dict[str, str], |
363 | | -) -> list: |
| 363 | +) -> list[go.Frame]: |
364 | 364 | """Merge animation frames for secondary y-axis combination. |
365 | 365 |
|
366 | 366 | Args: |
@@ -411,7 +411,9 @@ def _merge_secondary_y_frames( |
411 | 411 | return merged_frames |
412 | 412 |
|
413 | 413 |
|
414 | | -def update_traces(fig: go.Figure, selector: dict | None = None, **kwargs) -> go.Figure: |
| 414 | +def update_traces( |
| 415 | + fig: go.Figure, selector: dict[str, Any] | None = None, **kwargs: Any |
| 416 | +) -> go.Figure: |
415 | 417 | """Update traces in both base figure and all animation frames. |
416 | 418 |
|
417 | 419 | Plotly's `update_traces()` only updates the base figure, not animation frames. |
|
0 commit comments