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

Method stack_effect

Tools/cases_generator/parsing.py:465–476  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

463
464 @contextual
465 def stack_effect(self) -> StackEffect | None:
466 # IDENTIFIER [':' IDENTIFIER [TIMES]] ['if' '(' expression ')']
467 # | IDENTIFIER '[' expression ']'
468 if tkn := self.expect(lx.IDENTIFIER):
469 size_text = ""
470 if self.expect(lx.LBRACKET):
471 if not (size := self.expression()):
472 raise self.make_syntax_error("Expected expression")
473 self.require(lx.RBRACKET)
474 size_text = size.text.strip()
475 return StackEffect(tkn.text, size_text)
476 return None
477
478 @contextual
479 def expression(self) -> Expression | None:

Callers 2

inputMethod · 0.95
outputMethod · 0.95

Calls 6

expectMethod · 0.95
expressionMethod · 0.95
make_syntax_errorMethod · 0.95
requireMethod · 0.80
StackEffectClass · 0.70
stripMethod · 0.45

Tested by

no test coverage detected