MCPcopy Index your code
hub / github.com/python/cpython / variable_used

Function variable_used

Tools/cases_generator/analyzer.py:531–535  ·  view source on GitHub ↗

Determine whether a variable with a given name is used in a node.

(node: parser.CodeDef, name: str)

Source from the content-addressed store, hash-verified

529
530
531def variable_used(node: parser.CodeDef, name: str) -> bool:
532 """Determine whether a variable with a given name is used in a node."""
533 return any(
534 token.kind == "IDENTIFIER" and token.text == name for token in node.block.tokens()
535 )
536
537
538def oparg_used(node: parser.CodeDef) -> bool:

Callers 5

analyze_stackFunction · 0.85
has_error_with_popFunction · 0.85
has_error_without_popFunction · 0.85
compute_propertiesFunction · 0.85
make_uopFunction · 0.85

Calls 2

anyFunction · 0.50
tokensMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…