def sort_rows(self, rows, section):
"""
Sort the rows, as appropriate for the section.
Args:
rows(list): List of tuples (all same length, same values in each position)
section(str): Name of section, should match const in Differ class
"""
#print("@@ SORT ROWS:\n{}".format(rows))
# Section-specific determination of sort key
if section.lower() == Differ.CHANGED.lower():
sort_key = Differ.CHANGED_DELTA
else:
sort_key = None
if sort_key is not None:
rows.sort(key=itemgetter(sort_key))
评论列表
文章目录