Skip to content

Commit

Permalink
Improve activities.sorted() doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
dlax committed Jun 9, 2022
1 parent 403565a commit 1e2ecf5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pgactivity/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ def sorted(processes: List[T], *, key: SortKey, reverse: bool = False) -> List[T
>>> processes = sorted(processes, key=SortKey.mem)
>>> [p.pid for p in processes]
['6240', '6239', '6228']
>>> processes = sorted(processes, key=SortKey.duration, reverse=True) # sort by duration + pid asc
When using the 'duration' sort key, processes are also sorted by ascending PID:
>>> processes = sorted(processes, key=SortKey.duration, reverse=True)
>>> [p.pid for p in processes]
['6239', '6240', '6228']
"""
Expand Down

0 comments on commit 1e2ecf5

Please sign in to comment.