Skip to content

Commit bfdf279

Browse files
committed
mypy
1 parent 845038a commit bfdf279

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/spatialdata_plot/pl/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,7 @@ def _set_color_source_vec(
784784
logger.warning(f"No table name provided, using '{table_to_use}' as fallback for color mapping.")
785785

786786
# Check if custom colors exist in the table's .uns slot
787-
if _has_colors_in_uns(sdata, table_name, value_to_plot):
788-
print("no")
787+
if value_to_plot is not None and _has_colors_in_uns(sdata, table_name, value_to_plot):
789788
# Extract colors directly from the table's .uns slot
790789
color_mapping = _extract_colors_from_table_uns(
791790
sdata=sdata,
@@ -962,9 +961,6 @@ def _has_colors_in_uns(
962961

963962
adata = sdata.tables[table_to_use]
964963
color_key = f"{col_to_colorby}_colors"
965-
print(f"color_key: {color_key}")
966-
print(f"adata.uns: {adata.uns}")
967-
968964
return color_key in adata.uns
969965

970966

@@ -1042,7 +1038,7 @@ def _extract_colors_from_table_uns(
10421038
if len(hex_color) == 9: # #rrggbbaa format
10431039
hex_color = hex_color[:7] # Keep only #rrggbb
10441040
hex_colors.append(hex_color)
1045-
except Exception as e:
1041+
except (TypeError, ValueError) as e:
10461042
logger.warning(f"Error converting colors to hex format: {e}")
10471043
return None
10481044

0 commit comments

Comments
 (0)