Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 14, 2024
1 parent d548033 commit 4f15e9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
19 changes: 16 additions & 3 deletions vizro-ai/src/vizro_ai/_vizro_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion vizro-ai/src/vizro_ai/utils/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4f15e9e

Please sign in to comment.