MCPcopy Create free account
hub / github.com/microsoft/debugpy / report_paths

Function report_paths

src/debugpy/common/log.py:291–322  ·  view source on GitHub ↗
(get_paths, label=None)

Source from the content-addressed store, hash-verified

289 result.append(s.format(*args, **kwargs))
290
291 def report_paths(get_paths, label=None):
292 prefix = f" {label or get_paths}: "
293
294 expr = None
295 if not callable(get_paths):
296 expr = get_paths
297 get_paths = lambda: util.evaluate(expr)
298 try:
299 paths = get_paths()
300 except AttributeError:
301 report("{0}<missing>\n", prefix)
302 return
303 except Exception: # pragma: no cover
304 swallow_exception(
305 "Error evaluating {0}",
306 repr(expr) if expr else util.srcnameof(get_paths),
307 level="info",
308 )
309 return
310
311 if not isinstance(paths, (list, tuple)):
312 paths = [paths]
313
314 for p in sorted(paths):
315 report("{0}{1}", prefix, p)
316 if p is not None:
317 rp = os.path.realpath(p)
318 if p != rp:
319 report("({0})", rp)
320 report("\n")
321
322 prefix = " " * len(prefix)
323
324 report("System paths:\n")
325 report_paths("sys.executable")

Callers 1

Calls 4

swallow_exceptionFunction · 0.85
reprFunction · 0.85
reportFunction · 0.70
evaluateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…