Skip to content

Commit 86e6f28

Browse files
committed
🚚 move viz.py changes from phospho project version, lint w/ ruff
1 parent eee6be9 commit 86e6f28

File tree

5 files changed

+388
-163
lines changed

5 files changed

+388
-163
lines changed

.github/workflows/cdci.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: psf/black@stable
17-
# lint:
18-
# name: Lint with ruff
19-
# runs-on: ubuntu-latest
20-
# steps:
21-
# - uses: actions/checkout@v4
17+
lint:
18+
name: Lint with ruff
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
2222

23-
# - uses: actions/setup-python@v5
24-
# with:
25-
# python-version: "3.11"
26-
# - name: Install ruff
27-
# run: |
28-
# pip install ruff
29-
# - name: Lint with ruff
30-
# run: |
31-
# # stop the build if there are Python syntax errors or undefined names
32-
# ruff check .
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
- name: Install ruff
27+
run: |
28+
pip install ruff
29+
- name: Lint with ruff
30+
run: |
31+
ruff check .
3332
test:
3433
name: Test
3534
runs-on: ubuntu-latest

src/vuecore/Dendrogram.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from collections import OrderedDict
2+
13
import numpy as np
24
import scipy as scp
3-
from collections import OrderedDict
4-
import plotly.graph_objs as go
55

66

77
def plot_dendrogram(
@@ -58,7 +58,7 @@ def plot_dendrogram(
5858
color_threshold=color_threshold,
5959
)
6060

61-
if cutoff_line == True:
61+
if cutoff_line:
6262
dendrogram.layout.update(
6363
{
6464
"shapes": [
@@ -221,7 +221,7 @@ def set_axis_layout(self, axis_key, hide_labels):
221221

222222
self.layout[axis_key].update(axis_defaults)
223223

224-
if hide_labels == True:
224+
if hide_labels:
225225
self.layout[axis_key].update({"showticklabels": False})
226226
else:
227227
pass
@@ -280,8 +280,8 @@ def get_dendrogram_traces(
280280
icoord = scp.array(Z_dendrogram["icoord"])
281281
dcoord = scp.array(Z_dendrogram["dcoord"])
282282
ordered_labels = scp.array(Z_dendrogram["ivl"])
283-
color_list = scp.array(Z_dendrogram["color_list"])
284-
colors = self.get_color_dict(colorscale)
283+
# color_list = scp.array(Z_dendrogram["color_list"])
284+
# colors = self.get_color_dict(colorscale)
285285

286286
trace_list = []
287287

@@ -295,7 +295,7 @@ def get_dendrogram_traces(
295295
ys = dcoord[i]
296296
else:
297297
ys = icoord[i]
298-
color_key = color_list[i]
298+
# color_key = color_list[i] # not used
299299
hovertext_label = None
300300
if hovertext:
301301
hovertext_label = hovertext[i]

src/vuecore/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def networkx_to_neo4j_document(graph):
151151
rel_type = edge["type"]
152152
if "type" in graph.nodes()[r]:
153153
edge["type"] = graph.nodes()[r]["type"]
154-
if not (n, r, edge["type"]) in seen_rels:
154+
if (n, r, edge["type"]) not in seen_rels:
155155
rels[rel_type].append(edge)
156156
seen_rels.update({(n, r, edge["type"]), (r, n, edge["type"])})
157157
attr.update(rels)
@@ -268,9 +268,9 @@ def __extract_style(el):
268268
for k, v in [x.split(": ") for x in el.attrs["style"].split(";") if x != ""]
269269
}
270270

271-
if type(el) is str:
271+
if isinstance(el, str):
272272
return convert_html_to_dash(parse_html(el))
273-
if type(el) == bs.element.NavigableString:
273+
if isinstance(el, bs.element.NavigableString):
274274
return str(el)
275275
else:
276276
name = el.name

0 commit comments

Comments
 (0)