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

Method require

Tools/cases_generator/plexer.py:63–70  ·  view source on GitHub ↗
(self, kind: str)

Source from the content-addressed store, hash-verified

61 return None
62
63 def require(self, kind: str) -> Token:
64 # Return next token and advance position, requiring kind to match
65 tkn = self.next()
66 if tkn is not None and tkn.kind == kind:
67 return tkn
68 raise self.make_syntax_error(
69 f"Expected {kind!r} but got {tkn and tkn.text!r}", tkn
70 )
71
72 def consume_to(self, end: str) -> list[Token]:
73 res: list[Token] = []

Callers 8

inst_headerMethod · 0.80
cache_effectMethod · 0.80
stack_effectMethod · 0.80
macro_defMethod · 0.80
blockMethod · 0.80
if_stmtMethod · 0.80
for_stmtMethod · 0.80
while_stmtMethod · 0.80

Calls 2

nextMethod · 0.95
make_syntax_errorMethod · 0.95

Tested by

no test coverage detected