Skip to content

Commit

Permalink
refactor(plotting_utils): remove NoneType import
Browse files Browse the repository at this point in the history
Removed the unused `NoneType` import from `plotting_utils.py`. Updated
the `plot_correlation` method to use `None` checks instead of
`NoneType` for better readability and compatibility.
  • Loading branch information
psmyth94 committed Nov 18, 2024
1 parent 89a2081 commit 23b257f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/biofit/visualization/plotting_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
from os import PathLike
from types import NoneType
from typing import List, Optional, Union

import numpy as np
Expand Down Expand Up @@ -426,13 +425,13 @@ def plot_correlation(
"pointbiserialr": "Point Biserial Correlation",
}
value_name = name_map.get(corr_stat.config.method, "Correlation")
if isinstance(groupby, (Unset, NoneType)):
if groupby is None or isinstance(groupby, Unset):
groupby = "Features"
corrs = corrs.melt(var_name=groupby, value_name=value_name)
# drop na
corrs = corrs.dropna()
sorted_inds = np.argsort(np.abs(corrs[value_name]))[::-1]
if isinstance(top_k, (Unset, NoneType)):
if groupby is None or isinstance(top_k, Unset):
top_k = 30
corrs = corrs.iloc[sorted_inds[:top_k]]
return generate_barplot(
Expand Down

0 comments on commit 23b257f

Please sign in to comment.