MCPcopy
hub / github.com/mitmproxy/mitmproxy / remove

Method remove

mitmproxy/addonmanager.py:206–220  ·  view source on GitHub ↗

Remove an addon and all its sub-addons. If the addon is not in the chain - that is, if it's managed by a parent addon - it's the parent's responsibility to remove it from its own addons attribute.

(self, addon)

Source from the content-addressed store, hash-verified

204 self.chain.append(self.register(i))
205
206 def remove(self, addon):
207 """
208 Remove an addon and all its sub-addons.
209
210 If the addon is not in the chain - that is, if it's managed by a
211 parent addon - it's the parent's responsibility to remove it from
212 its own addons attribute.
213 """
214 for a in traverse([addon]):
215 n = _get_name(a)
216 if n not in self.lookup:
217 raise exceptions.AddonManagerError("No such addon: %s" % n)
218 self.chain = [i for i in self.chain if i is not a]
219 del self.lookup[_get_name(a)]
220 self.invoke_addon_sync(addon, hooks.DoneHook())
221
222 def __len__(self):
223 return len(self.chain)

Callers 4

test_haltFunction · 0.95
test_async_haltFunction · 0.95
test_lifecycleFunction · 0.95
test_nestingFunction · 0.95

Calls 3

invoke_addon_syncMethod · 0.95
traverseFunction · 0.85
_get_nameFunction · 0.85

Tested by 4

test_haltFunction · 0.76
test_async_haltFunction · 0.76
test_lifecycleFunction · 0.76
test_nestingFunction · 0.76