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

Function module_order

mypy/test/helpers.py:116–134  ·  view source on GitHub ↗
(errors: list[str])

Source from the content-addressed store, hash-verified

114
115
116def module_order(errors: list[str]) -> list[str]:
117 result = []
118 seen = set()
119 mods = []
120 for e in errors:
121 if ":" not in e:
122 dump_original_errors(errors)
123 pytest.fail(f"Only module scoped errors are supported, got {e}")
124 mod, _ = e.split(":", maxsplit=1)
125 mods.append(mod)
126 for i, mod in enumerate(mods):
127 if i > 0:
128 if mod != mods[i - 1] and mod in seen:
129 dump_original_errors(errors)
130 pytest.fail(f"Each module must form a single block, {mod} appears split")
131 if mod not in seen:
132 result.append(mod)
133 seen.add(mod)
134 return result
135
136
137def match_module_order(actual: list[str], expected_order: list[str]) -> list[str]:

Callers 2

match_module_orderFunction · 0.85

Calls 7

setClass · 0.85
dump_original_errorsFunction · 0.85
enumerateFunction · 0.85
splitMethod · 0.80
appendMethod · 0.80
failMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…