Repository navigation
Fix Ruff rule RET504 violations in astropy/visualization - #17818
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
nstarman
left a comment
There was a problem hiding this comment.
Thanks @IamPhytan for the PR!
eerovaher
left a comment
There was a problem hiding this comment.
If .ruff.toml is not updated then Ruff will not guard against RET504 violations being reintroduced to visualization.
|
|
||
| if bb: | ||
| _bbox = Bbox.union(bb) | ||
| return _bbox | ||
| return Bbox.union(bb) | ||
| else: | ||
| return self.get_window_extent(renderer) |
There was a problem hiding this comment.
It is clear that bb cannot be falsy, so this will always return Bbox.union(bb).
df6ccca to
ae4b5a3
Compare
Fixed it with an amendment on the original commit |
eerovaher
left a comment
There was a problem hiding this comment.
I will let the sub-package maintainers do the final review.
| return _bbox | ||
| else: | ||
| return self.get_window_extent(renderer) | ||
| return Bbox.union(bb) |
There was a problem hiding this comment.
I think this is fine even though non-trivial because the append above ensures there will always be one element in the list even if it is None for instance, so the list will never be empty
Description
This pull request address the violations of Ruff rule RET504 in
astropy/visualization.Partially addresses #14818