Skip to content

Commit 1a3c7e9

Browse files
committed
fix: add hasattr check for robustness in _get_category_colors
1 parent fd7b4dd commit 1a3c7e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cellmapper/model/evaluate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _get_category_colors(
4545
colors_key = f"{label_key}_colors"
4646
colors_dict: dict[str, str] = {}
4747

48-
if adata is not None and colors_key in adata.uns:
48+
if adata is not None and hasattr(adata, "uns") and colors_key in adata.uns:
4949
full_categories = adata.obs[label_key].cat.categories
5050
full_colors = adata.uns[colors_key]
5151
for i, cat in enumerate(full_categories):

0 commit comments

Comments
 (0)