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

Function split_target

mypy/util.py:102–111  ·  view source on GitHub ↗
(modules: Iterable[str], target: str)

Source from the content-addressed store, hash-verified

100
101
102def split_target(modules: Iterable[str], target: str) -> tuple[str, str] | None:
103 remaining: list[str] = []
104 while True:
105 if target in modules:
106 return target, ".".join(remaining)
107 components = target.rsplit(".", 1)
108 if len(components) == 1:
109 return None
110 target = components[0]
111 remaining.insert(0, components[1])
112
113
114def short_type(obj: object) -> str:

Callers 5

find_nodeMethod · 0.90
visit_instanceMethod · 0.90
_lookup_target_implFunction · 0.90
load_final_staticMethod · 0.90
module_prefixFunction · 0.85

Calls 4

lenFunction · 0.85
rsplitMethod · 0.80
insertMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…