Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed.
(self, fn)
| 244 | # New method not in PEP 3148. |
| 245 | |
| 246 | def remove_done_callback(self, fn): |
| 247 | """Remove all instances of a callback from the "call when done" list. |
| 248 | |
| 249 | Returns the number of callbacks removed. |
| 250 | """ |
| 251 | filtered_callbacks = [(f, ctx) |
| 252 | for (f, ctx) in self._callbacks |
| 253 | if f != fn] |
| 254 | removed_count = len(self._callbacks) - len(filtered_callbacks) |
| 255 | if removed_count: |
| 256 | self._callbacks[:] = filtered_callbacks |
| 257 | return removed_count |
| 258 | |
| 259 | # So-called internal methods (note: no set_running_or_notify_cancel()). |
| 260 |
no outgoing calls
no test coverage detected