File tree 1 file changed +18
-3
lines changed
Filter options
1 file changed +18
-3
lines changed
Original file line number Diff line number Diff line change @@ -41,13 +41,23 @@ def items(self):
41
41
return reversed (self ._queue .values ())
42
42
43
43
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
+ """
45
50
self ._check_nonempty ()
46
51
((priority , _ ), item ) = self ._queue .peekitem ()
47
52
return item , priority
48
53
49
54
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
+ """
51
61
self ._check_nonempty ()
52
62
(key , item ) = self ._queue .popitem ()
53
63
i = self ._items .index ((item , key ))
@@ -78,7 +88,12 @@ def _find_first(self, item):
78
88
return i , key
79
89
80
90
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
+ """
82
97
i , key = self ._find_first (item )
83
98
del self ._queue [key ]
84
99
del self ._items [i ]
You can’t perform that action at this time.
0 commit comments