Skip to content

Commit

Permalink
add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanSoley committed Jan 30, 2024
1 parent 098d3b9 commit 3cb6bb0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions rubicon_ml/viz/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import warnings
from typing import Dict, Literal, Optional, Union

import dash_bootstrap_components as dbc
from dash import Dash, html
Expand All @@ -17,7 +18,7 @@ class VizBase:

def __init__(
self,
dash_title="base",
dash_title: Optional[str] = "base",
):
self.dash_title = f"rubicon-ml: {dash_title}"

Expand Down Expand Up @@ -52,13 +53,17 @@ def load_experiment_data(self):
"extensions of `VizBase` must implement `load_experiment_data(self)`"
)

def register_callbacks(self, link_experiment_table=False):
def register_callbacks(self, link_experiment_table: Optional[bool] = False):
raise NotImplementedError(
"extensions of `VizBase` must implement `register_callbacks(self)`"
)

def serve(
self, in_background=False, jupyter_mode="external", dash_kwargs={}, run_server_kwargs={}
self,
in_background: Optional[bool] = False,
jupyter_mode: Optional[Literal["external", "inline", "jupyterlab", "tab"]] = "external",
dash_kwargs: Optional[Dict] = {},
run_server_kwargs: Optional[Dict] = {},
):
"""Serve the Dash app on the next available port to render the visualization.
Expand Down Expand Up @@ -133,7 +138,12 @@ def serve(
self.app.run(**default_run_server_kwargs)

def show(
self, i_frame_kwargs={}, dash_kwargs={}, run_server_kwargs={}, height=None, width=None
self,
i_frame_kwargs: Optional[Dict] = {},
dash_kwargs: Optional[Dict] = {},
run_server_kwargs: Optional[Dict] = {},
height: Optional[Union[bool, None]] = None,
width: Optional[Union[bool, None]] = None,
):
"""Serve the Dash app on the next available port to render the visualization.
Expand Down

0 comments on commit 3cb6bb0

Please sign in to comment.