MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / merge

Method merge

mitmproxy/optmanager.py:287–300  ·  view source on GitHub ↗

Merge a dict of options into this object. Options that have None value are ignored. Lists and tuples are appended to the current option value.

(self, opts)

Source from the content-addressed store, hash-verified

285 return self._options[option].has_changed()
286
287 def merge(self, opts):
288 """
289 Merge a dict of options into this object. Options that have None
290 value are ignored. Lists and tuples are appended to the current
291 option value.
292 """
293 toset = {}
294 for k, v in opts.items():
295 if v is not None:
296 if isinstance(v, (list, tuple)):
297 toset[k] = getattr(self, k) + v
298 else:
299 toset[k] = v
300 self.update(**toset)
301
302 def __repr__(self):
303 options = pprint.pformat(self._options, indent=4).strip(" {}")

Callers 1

test_mergeFunction · 0.45

Calls 2

updateMethod · 0.95
itemsMethod · 0.45

Tested by 1

test_mergeFunction · 0.36