MCPcopy
hub / github.com/mitmproxy/mitmproxy / load_paths

Function load_paths

mitmproxy/optmanager.py:564–581  ·  view source on GitHub ↗

Load paths in order. Each path takes precedence over the previous path. Paths that don't exist are ignored, errors raise an OptionsError.

(opts: OptManager, *paths: Path | str)

Source from the content-addressed store, hash-verified

562
563
564def load_paths(opts: OptManager, *paths: Path | str) -> None:
565 """
566 Load paths in order. Each path takes precedence over the previous
567 path. Paths that don't exist are ignored, errors raise an
568 OptionsError.
569 """
570 for p in paths:
571 p = Path(p).expanduser()
572 if p.exists() and p.is_file():
573 with p.open(encoding="utf8") as f:
574 try:
575 txt = f.read()
576 except UnicodeDecodeError as e:
577 raise exceptions.OptionsError(f"Error reading {p}: {e}")
578 try:
579 load(opts, txt, cwd=p.absolute().parent)
580 except exceptions.OptionsError as e:
581 raise exceptions.OptionsError(f"Error reading {p}: {e}")
582
583
584def serialize(

Callers

nothing calls this directly

Calls 4

PathClass · 0.85
loadFunction · 0.70
openMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…