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

Method uop

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

Source from the content-addressed store, hash-verified

534
535 @contextual
536 def uop(self) -> UOp | None:
537 if tkn := self.expect(lx.IDENTIFIER):
538 if self.expect(lx.DIVIDE):
539 sign = 1
540 if negate := self.expect(lx.MINUS):
541 sign = -1
542 if num := self.expect(lx.NUMBER):
543 try:
544 size = sign * int(num.text)
545 except ValueError:
546 raise self.make_syntax_error(
547 f"Expected integer, got {num.text!r}"
548 )
549 else:
550 return CacheEffect(tkn.text, size)
551 raise self.make_syntax_error("Expected integer")
552 else:
553 return OpName(tkn.text)
554 return None
555
556 @contextual
557 def family_def(self) -> Family | None:

Callers 1

uopsMethod · 0.95

Calls 4

expectMethod · 0.95
make_syntax_errorMethod · 0.95
CacheEffectClass · 0.85
OpNameClass · 0.85

Tested by

no test coverage detected