-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-investogationIssue requires clarification or more details to understand fullyIssue requires clarification or more details to understand fully
Description
Description:
In src/stonerplots/context/double_y.py:157, the good_colour() method has potentially incorrect logic when self.colours is a string:
match self.colours:
case list() if -len(self.colours) < axis < len(self.colours):
return self.colours[axis] is not None
case str() if -len(self.colours) < axis < len(self.colours):
return True
case _:
return FalseWhen self.colours is a string (e.g., "red"), len(self.colours) returns the string length (3 for "red"), not the number of colours (1). The condition -len(self.colours) < axis < len(self.colours) checks -3 < axis < 3, which may not be the intended behavior.
Questions to Clarify:
- Should a string colour apply to all axes?
- Should string length matter, or should it be treated as a single colour?
- Is the string case meant to handle comma-separated colours?
Suggested Fix (if string should apply to all axes):
def good_colour(self, axis: int) -> bool:
"""Return True if we have a colour defined for this axis."""
axis = int(axis)
if self.colours is None:
return False
match self.colours:
case str(): # Single colour string applies to all axes
return True
case list() if -len(self.colours) < axis < len(self.colours):
return self.colours[axis] is not None
case _:
return FalseReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-investogationIssue requires clarification or more details to understand fullyIssue requires clarification or more details to understand fully