MCPcopy
hub / github.com/python/mypy / process_functions

Function process_functions

mypy/semanal_main.py:254–277  ·  view source on GitHub ↗
(graph: Graph, scc: list[str], patches: Patches)

Source from the content-addressed store, hash-verified

252
253
254def process_functions(graph: Graph, scc: list[str], patches: Patches) -> None:
255 # Process functions.
256 all_targets = []
257 for module in scc:
258 tree = graph[module].tree
259 assert tree is not None
260 # In principle, functions can be processed in arbitrary order,
261 # but _methods_ must be processed in the order they are defined,
262 # because some features (most notably partial types) depend on
263 # order of definitions on self.
264 #
265 # There can be multiple generated methods per line. Use target
266 # name as the second sort key to get a repeatable sort order.
267 targets = sorted(get_all_leaf_targets(tree), key=lambda x: (x[1].line, x[0]))
268 all_targets.extend(
269 [(module, target, node, active_type) for target, node, active_type in targets]
270 )
271
272 for module, target, node, active_type in order_by_subclassing(all_targets):
273 analyzer = graph[module].manager.semantic_analyzer
274 assert isinstance(node, (FuncDef, OverloadedFuncDef, Decorator)), node
275 process_top_level_function(
276 analyzer, graph[module], module, target, node, active_type, patches
277 )
278
279
280def process_top_level_function(

Callers 1

Calls 6

sortedFunction · 0.85
get_all_leaf_targetsFunction · 0.85
order_by_subclassingFunction · 0.85
isinstanceFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…