Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CQ: replace a loop by a list comprehension in gmodeler.canvas #4814

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions gui/wxpython/gmodeler/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,11 @@
shape.Select(False, dc)
else:
shapeList = canvas.GetDiagram().GetShapeList()
toUnselect = []

if not append:
for s in shapeList:
if s.Selected():
toUnselect.append(s)
toUnselect = [s for s in shapeList if s.Selected()]
else:
toUnselect = []

Check failure on line 447 in gui/wxpython/gmodeler/canvas.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (SIM108)

gui/wxpython/gmodeler/canvas.py:444:13: SIM108 Use ternary operator `toUnselect = [s for s in shapeList if s.Selected()] if not append else []` instead of `if`-`else`-block
pesekon2 marked this conversation as resolved.
Show resolved Hide resolved

shape.Select(True, dc)

Expand Down
Loading