MCPcopy
hub / github.com/mitmproxy/mitmproxy / update

Method update

mitmproxy/addons/view.py:634–660  ·  view source on GitHub ↗

Updates a list of flows. If flow is not in the state, it's ignored.

(self, flows: Sequence[mitmproxy.flow.Flow])

Source from the content-addressed store, hash-verified

632 self.update([f])
633
634 def update(self, flows: Sequence[mitmproxy.flow.Flow]) -> None:
635 """
636 Updates a list of flows. If flow is not in the state, it's ignored.
637 """
638 for f in flows:
639 if f.id in self._store:
640 if self.filter(f):
641 if f not in self._view:
642 self._base_add(f)
643 if self.focus_follow:
644 self.focus.flow = f
645 self.sig_view_add.send(flow=f)
646 else:
647 # This is a tad complicated. The sortedcontainers
648 # implementation assumes that the order key is stable. If
649 # it changes mid-way Very Bad Things happen. We detect when
650 # this happens, and re-fresh the item.
651 self.order_key.refresh(f)
652 self.sig_view_update.send(flow=f)
653 else:
654 try:
655 idx = self._view.index(f)
656 except ValueError:
657 pass # The value was not in the view
658 else:
659 self._view.remove(f)
660 self.sig_view_remove.send(flow=f, index=idx)
661
662
663class Focus:

Callers 15

test_order_refreshFunction · 0.95
test_updateFunction · 0.95
test_signalsFunction · 0.95
test_focus_followFunction · 0.95
errorMethod · 0.95
responseMethod · 0.95
interceptMethod · 0.95
resumeMethod · 0.95
killMethod · 0.95
tcp_messageMethod · 0.95
tcp_errorMethod · 0.95
tcp_endMethod · 0.95

Calls 6

_base_addMethod · 0.95
filterMethod · 0.45
sendMethod · 0.45
refreshMethod · 0.45
indexMethod · 0.45
removeMethod · 0.45

Tested by 8

test_order_refreshFunction · 0.76
test_updateFunction · 0.76
test_signalsFunction · 0.76
test_focus_followFunction · 0.76
test_defaultsFunction · 0.36
test_optionsFunction · 0.36
test_statusbarFunction · 0.36
test_simpleMethod · 0.36