Skip to content

Commit

Permalink
[sort] fix build; use .sort() instead of =sorted()
Browse files Browse the repository at this point in the history
- by not sorting in-place, sorting on columns sheet would not sort columns on
source sheet, breaking the tests
  • Loading branch information
saulpw committed Nov 26, 2018
1 parent 0cbb256 commit 3930ad0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion visidata/vdtui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,8 @@ def gatherBy(self, func):
def orderBy(self, *cols, **kwargs):
try:
with Progress(self.rows) as prog:
self.rows = sorted(self.rows, key=lambda r,cols=cols,prog=prog: prog.addProgress(1) and tuple(c.getTypedValueNoExceptions(r) for c in cols), **kwargs)
# must not reassign self.rows: use .sort() instead of sorted()
self.rows.sort(key=lambda r,cols=cols,prog=prog: prog.addProgress(1) and tuple(c.getTypedValueNoExceptions(r) for c in cols), **kwargs)
except TypeError as e:
status('sort incomplete due to TypeError; change column type')
exceptionCaught(e, status=False)
Expand Down

0 comments on commit 3930ad0

Please sign in to comment.