Skip to content

Commit

Permalink
Remove internal type shed for plotly
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/Ax#2715

Recent versions of plotly ship with type annotations, so we can remove outdated internal type shed stubs. This fixes a lot of false positive errors and only introduces a relatively small amount of false positive errors.

Reviewed By: stroxler

Differential Revision: D61731048

fbshipit-source-id: 1ff8a1385eff1ac37afd6794bb18c71294b77197
  • Loading branch information
JoostHouben authored and facebook-github-bot committed Aug 26, 2024
1 parent c04266e commit 97f5aa4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions kats/detectors/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
try:
import plotly.graph_objs as go

# pyre-fixme[5]: Global expression must be annotated.
Figure = go.Figure
except ImportError:
Figure = object
Expand Down Expand Up @@ -124,6 +125,7 @@ def remover(self, interpolate: bool = False) -> TimeSeriesData:
ts_out = TimeSeriesData(df_final)
return ts_out

# pyre-fixme[11]: Annotation `Figure` is not defined as a type.
def plot(self, **kwargs: Any) -> Union[plt.Axes, Sequence[plt.Axes], Figure]:
raise NotImplementedError()

Expand Down
2 changes: 2 additions & 0 deletions kats/detectors/seasonality.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
try:
import plotly.graph_objs as go

# pyre-fixme[5]: Global expression must be annotated.
Figure = go.Figure
except ImportError:
Figure = object
Expand Down Expand Up @@ -236,6 +237,7 @@ def plot(
title: str = "FFT",
mad_threshold: float = 6.0,
**kwargs: Any,
# pyre-fixme[11]: Annotation `Figure` is not defined as a type.
) -> Figure:
"""Plots an FFT plot as a plotly figure
Expand Down
6 changes: 5 additions & 1 deletion kats/graphics/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
import plotly.graph_objs as go

_no_plotly = False
# pyre-fixme[5]: Global expression must be annotated.
Figure = go.Figure
except ImportError:
_no_plotly = True
Figure = object


def plot_scatter_with_confints(
val: List[float], confint: np.ndarray, title: str
val: List[float],
confint: np.ndarray,
title: str,
# pyre-fixme[11]: Annotation `Figure` is not defined as a type.
) -> Figure:
"""Plots a scatter plot with confidence intervals used to plot ACF and PACF
Parameters
Expand Down

0 comments on commit 97f5aa4

Please sign in to comment.