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