Skip to content

Commit

Permalink
flake8/linter cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brifordwylie committed Dec 28, 2024
1 parent c7dbbff commit b062535
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion applications/experiments/compound_explorer/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Callbacks for the FeatureSets Subpage Web User Interface"""

import dash
from dash import html, Input, Output, callback
from dash.exceptions import PreventUpdate
Expand All @@ -7,7 +8,7 @@
# Workbench Imports
from workbench.api import FeatureSet
from workbench.web_interface.components.plugins import scatter_plot
from workbench.utils.chem_utils import img_from_smiles, svg_from_smiles
from workbench.utils.chem_utils import img_from_smiles

custom_data_fields = ["id", "molwt", "smiles"]

Expand Down
2 changes: 1 addition & 1 deletion applications/experiments/compound_explorer/layout.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""FeatureSets Layout: Layout for the FeatureSets page in the Artifact Viewer"""

from dash import html, dcc, dash_table
from dash import html, dcc
import dash_bootstrap_components as dbc

# FIXME
Expand Down
5 changes: 3 additions & 2 deletions src/workbench/utils/chem_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np
import pandas as pd
from typing import Optional
import base64

# Workbench Imports
from workbench.utils.pandas_utils import feature_quality_metrics
Expand Down Expand Up @@ -63,7 +64,7 @@ def img_from_smiles(smiles: str, width: int = 500, height: int = 500, dark_mode:
# Convert the SMILES string to an RDKit molecule and generate the image
mol = Chem.MolFromSmiles(smiles)
if mol:
img = Draw.MolToImage(mol, options=dos, size=(width, height))
img = Draw.MolToImage(mol, options=dos, size=(width, height))
return img
else:
log.warning(f"Invalid SMILES: {smiles}")
Expand Down Expand Up @@ -124,7 +125,7 @@ def svg_from_smiles(smiles: str) -> Optional[str]:
# Note: html.Img(
# src=f"data:image/svg+xml;base64,{encoded_svg}",
# ),
encoded_svg = base64.b64encode(svg.encode('utf-8')).decode()
encoded_svg = base64.b64encode(svg.encode("utf-8")).decode()
return encoded_svg
else:
return None
Expand Down
7 changes: 5 additions & 2 deletions src/workbench/web_interface/components/plugin_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# Workbench Imports
from workbench.web_interface.components.plugin_interface import PluginInterface, PluginInputType
from workbench.api import DataSource, FeatureSet, Model, Endpoint
from workbench.cached.cached_meta import CachedMeta
from workbench.api.pipeline import Pipeline
from workbench.core.artifacts.graph_core import GraphCore
from workbench.utils.theme_manager import ThemeManager
Expand Down Expand Up @@ -118,7 +117,11 @@ def _trigger_update(self):
graph = self.input_data if self.input_data is not None else GraphCore("karate_club")
return self.plugin.update_properties(graph, labels="club", hover_text=["club", "degree"], **self.kwargs)
elif plugin_input_type == PluginInputType.DATAFRAME:
model_df = self.input_data if self.input_data is not None else FeatureSet("abalone_features").pull_dataframe()[:1000]
model_df = (
self.input_data
if self.input_data is not None
else FeatureSet("abalone_features").pull_dataframe()[:1000]
)
return self.plugin.update_properties(model_df, **self.kwargs)
else:
raise ValueError(f"Invalid test type: {plugin_input_type}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Union
import pandas as pd
from dash import dcc, html, callback, Input, Output
import plotly.graph_objects as go
Expand Down

0 comments on commit b062535

Please sign in to comment.