Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5d3434d

Browse filesBrowse files
committed
update priority queue docstring
1 parent 32518d1 commit 5d3434d
Copy full SHA for 5d3434d

File tree

1 file changed

+18
-3
lines changed
Filter options

1 file changed

+18
-3
lines changed

‎adaptive/priority_queue.py

Copy file name to clipboardExpand all lines: adaptive/priority_queue.py
+18-3Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,23 @@ def items(self):
4141
return reversed(self._queue.values())
4242

4343
def peek(self):
44-
"Return the item and priority at the front of the queue."
44+
"""Return the item and priority at the front of the queue.
45+
46+
Raises
47+
------
48+
Empty : if the queue is empty
49+
"""
4550
self._check_nonempty()
4651
((priority, _), item) = self._queue.peekitem()
4752
return item, priority
4853

4954
def pop(self):
50-
"Remove and return the item and priority at the front of the queue."
55+
"""Remove and return the item and priority at the front of the queue.
56+
57+
Raises
58+
------
59+
Empty : if the queue is empty
60+
"""
5161
self._check_nonempty()
5262
(key, item) = self._queue.popitem()
5363
i = self._items.index((item, key))
@@ -78,7 +88,12 @@ def _find_first(self, item):
7888
return i, key
7989

8090
def remove(self, item):
81-
"Remove the 'item' from the queue."
91+
"""Remove the 'item' from the queue.
92+
93+
Raises
94+
------
95+
KeyError : if 'item' is not in the queue.
96+
"""
8297
i, key = self._find_first(item)
8398
del self._queue[key]
8499
del self._items[i]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.