From 97f5aa40fd4c8b5c20f899ac01b60c76ec14c784 Mon Sep 17 00:00:00 2001 From: Joost Houben Date: Mon, 26 Aug 2024 14:18:07 -0700 Subject: [PATCH] Remove internal type shed for plotly Summary: X-link: https://github.com/facebook/Ax/pull/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 --- kats/detectors/detector.py | 2 ++ kats/detectors/seasonality.py | 2 ++ kats/graphics/plots.py | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/kats/detectors/detector.py b/kats/detectors/detector.py index 91014fc3..669ad296 100644 --- a/kats/detectors/detector.py +++ b/kats/detectors/detector.py @@ -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 @@ -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() diff --git a/kats/detectors/seasonality.py b/kats/detectors/seasonality.py index f3acd579..a2962740 100644 --- a/kats/detectors/seasonality.py +++ b/kats/detectors/seasonality.py @@ -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 @@ -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 diff --git a/kats/graphics/plots.py b/kats/graphics/plots.py index 8e7e1aea..c2b05161 100644 --- a/kats/graphics/plots.py +++ b/kats/graphics/plots.py @@ -16,6 +16,7 @@ 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 @@ -23,7 +24,10 @@ 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