Uninstall plugins. Pass an instance to remove a specific plugin, a type object to remove all plugins that match that type, a string to remove all plugins with a matching ``name`` attribute or ``True`` to remove all plugins. Return the list of removed plugins.
(self, plugin)
| 724 | return plugin |
| 725 | |
| 726 | def uninstall(self, plugin): |
| 727 | ''' Uninstall plugins. Pass an instance to remove a specific plugin, a type |
| 728 | object to remove all plugins that match that type, a string to remove |
| 729 | all plugins with a matching ``name`` attribute or ``True`` to remove all |
| 730 | plugins. Return the list of removed plugins. ''' |
| 731 | removed, remove = [], plugin |
| 732 | for i, plugin in list(enumerate(self.plugins))[::-1]: |
| 733 | if remove is True or remove is plugin or remove is type(plugin) \ |
| 734 | or getattr(plugin, 'name', True) == remove: |
| 735 | removed.append(plugin) |
| 736 | del self.plugins[i] |
| 737 | if hasattr(plugin, 'close'): plugin.close() |
| 738 | if removed: self.reset() |
| 739 | return removed |
| 740 | |
| 741 | def reset(self, route=None): |
| 742 | ''' Reset all routes (force plugins to be re-applied) and clear all |