From 4f15e9e8f8ec3b9c15d41c5731de3fe7d82bfc93 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 14 Jun 2024 11:33:55 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- vizro-ai/src/vizro_ai/_vizro_ai.py | 19 ++++++++++++++++--- vizro-ai/src/vizro_ai/utils/helper.py | 6 +++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/vizro-ai/src/vizro_ai/_vizro_ai.py b/vizro-ai/src/vizro_ai/_vizro_ai.py index be9697ea6..667d41283 100644 --- a/vizro-ai/src/vizro_ai/_vizro_ai.py +++ b/vizro-ai/src/vizro_ai/_vizro_ai.py @@ -58,7 +58,12 @@ def _lazy_get_component(self, component_class: Any) -> Any: # TODO configure co return self.components_instances[component_class] def _run_plot_tasks( - self, df: pd.DataFrame, user_input: str, max_debug_retry: int = 3, explain: bool = False, return_elements: bool = False + self, + df: pd.DataFrame, + user_input: str, + max_debug_retry: int = 3, + explain: bool = False, + return_elements: bool = False, ) -> PlotOutputs: """Task execution.""" chart_type_pipeline = self.pipeline_manager.chart_type_pipeline @@ -86,7 +91,11 @@ def _run_plot_tasks( ) fig_object = _exec_code_and_retrieve_fig( - code=code_string, local_args={"df": df}, show_fig=_is_jupyter(), is_notebook_env=_is_jupyter(), return_elements=return_elements + code=code_string, + local_args={"df": df}, + show_fig=_is_jupyter(), + is_notebook_env=_is_jupyter(), + return_elements=return_elements, ) if explain: business_insights, code_explanation = self._lazy_get_component(GetCodeExplanation).run( @@ -137,7 +146,11 @@ def plot( # pylint: disable=too-many-arguments # noqa: PLR0913 """ vizro_plot = self._run_plot_tasks( - df=df, user_input=user_input, explain=explain, max_debug_retry=max_debug_retry, return_elements=return_elements + df=df, + user_input=user_input, + explain=explain, + max_debug_retry=max_debug_retry, + return_elements=return_elements, ) if not explain: diff --git a/vizro-ai/src/vizro_ai/utils/helper.py b/vizro-ai/src/vizro_ai/utils/helper.py index 17a2d5cc0..84c469573 100644 --- a/vizro-ai/src/vizro_ai/utils/helper.py +++ b/vizro-ai/src/vizro_ai/utils/helper.py @@ -60,7 +60,11 @@ def _debug_helper( def _exec_code_and_retrieve_fig( - code: str, local_args: Optional[Dict] = None, show_fig: bool = False, is_notebook_env: bool = True, return_elements: bool = False + code: str, + local_args: Optional[Dict] = None, + show_fig: bool = False, + is_notebook_env: bool = True, + return_elements: bool = False, ) -> go.Figure: """Execute code in notebook with correct namespace and return fig object.