Skip to content

Commit

Permalink
Merge pull request #1453 from bsipocz/database_adding_sort_to_display…
Browse files Browse the repository at this point in the history
…_entries

adding sort argument to display_entries to avoid doctest failures
  • Loading branch information
ayshih committed Jun 17, 2015
2 parents 20f72fb + cf4bdb5 commit 4f5729c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sunpy/database/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def entries_from_dir(fitsdir, recursive=False, pattern='*',
break


def display_entries(database_entries, columns):
def display_entries(database_entries, columns, sort=False):
"""Generate a table to display the database entries.
Parameters
Expand All @@ -591,6 +591,9 @@ def display_entries(database_entries, columns):
The columns that will be displayed in the resulting table. Possible
values for the strings are all attributes of :class:`DatabaseEntry`.
sort : bool (optional)
If True, sorts the entries before displaying them.
Returns
-------
str
Expand Down Expand Up @@ -626,4 +629,6 @@ def display_entries(database_entries, columns):
data.append(row)
if not data:
raise TypeError('given iterable is empty')
if sort:
data.sort()
return print_table(header + rulers + data)

0 comments on commit 4f5729c

Please sign in to comment.