MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / uninstall

Method uninstall

21-async/mojifinder/bottle.py:726–739  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

resetMethod · 0.95
appendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected