MCPcopy Index your code
hub / github.com/python/mypy / path_to_str

Function path_to_str

mypy/server/mergecheck.py:69–84  ·  view source on GitHub ↗
(path: list[tuple[object, object]])

Source from the content-addressed store, hash-verified

67
68
69def path_to_str(path: list[tuple[object, object]]) -> str:
70 result = "<root>"
71 for attr, obj in path:
72 t = type(obj).__name__
73 if t in ("dict", "tuple", "SymbolTable", "list"):
74 result += f"[{repr(attr)}]"
75 else:
76 if isinstance(obj, Var):
77 result += f".{attr}({t}:{obj.name})"
78 elif t in ("BuildManager", "FineGrainedBuildManager"):
79 # Omit class name for some classes that aren't part of a class
80 # hierarchy since there isn't much ambiguity.
81 result += f".{attr}"
82 else:
83 result += f".{attr}({t})"
84 return result

Callers 1

check_consistencyFunction · 0.85

Calls 3

typeClass · 0.85
reprFunction · 0.85
isinstanceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…