MCPcopy Create free account
hub / github.com/python/cpython / find_stores_in_tokens

Function find_stores_in_tokens

Tools/cases_generator/analyzer.py:444–459  ·  view source on GitHub ↗
(tokens: list[lexer.Token], callback: Callable[[lexer.Token], None])

Source from the content-addressed store, hash-verified

442 innames = { out.name for out in node.inputs }
443
444 def find_stores_in_tokens(tokens: list[lexer.Token], callback: Callable[[lexer.Token], None]) -> None:
445 while tokens and tokens[0].kind == "COMMENT":
446 tokens = tokens[1:]
447 if len(tokens) < 4:
448 return
449 if tokens[1].kind == "EQUALS":
450 if tokens[0].kind == "IDENTIFIER":
451 name = tokens[0].text
452 if name in outnames or name in innames:
453 callback(tokens[0])
454 #Passing the address of a local is also a definition
455 for idx, tkn in enumerate(tokens):
456 if tkn.kind == "AND":
457 name_tkn = tokens[idx+1]
458 if name_tkn.text in outnames:
459 callback(name_tkn)
460
461 def visit(stmt: Stmt) -> None:
462 if isinstance(stmt, IfStmt):

Callers 1

visitFunction · 0.85

Calls 2

enumerateFunction · 0.85
callbackFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…