MCPcopy Create free account
hub / github.com/nodejs/node / expect

Method expect

tools/gyp/pylib/packaging/_tokenizer.py:134–141  ·  view source on GitHub ↗

Expect a certain token name next, failing with a syntax error otherwise. The token is *not* read.

(self, name: str, *, expected: str)

Source from the content-addressed store, hash-verified

132 return True
133
134 def expect(self, name: str, *, expected: str) -> Token:
135 """Expect a certain token name next, failing with a syntax error otherwise.
136
137 The token is *not* read.
138 """
139 if not self.check(name):
140 raise self.raise_syntax_error(f"Expected {expected}")
141 return self.read()
142
143 def read(self) -> Token:
144 """Consume the next token and return it."""

Callers 5

_parse_requirementFunction · 0.45
_parse_extras_listFunction · 0.45
_parse_full_markerFunction · 0.45
_parse_marker_opFunction · 0.45

Calls 3

checkMethod · 0.95
raise_syntax_errorMethod · 0.95
readMethod · 0.95

Tested by

no test coverage detected