def _sorted_table(table):
"""
Returns another TableElement where the table entries are sorted lexicographically by key.
"""
assert isinstance(table, TableElement)
# Discarding TokenElements with no tokens in them
table_elements = common.non_empty_elements(table.sub_elements)
lines = tuple(common.lines(table_elements))
sorted_lines = sorted(lines, key=_line_key)
sorted_elements = reduce(operator.concat, sorted_lines)
return TableElement(sorted_elements)
评论列表
文章目录