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

Method annotation

Tools/peg_generator/pegen/grammar_parser.py:551–567  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

549
550 @memoize
551 def annotation(self) -> Optional[str]:
552 # annotation: "[" ~ target_atoms "]"
553 mark = self._mark()
554 cut = False
555 if (
556 (literal := self.expect("["))
557 and
558 (cut := True)
559 and
560 (target_atoms := self.target_atoms())
561 and
562 (literal_1 := self.expect("]"))
563 ):
564 return target_atoms
565 self._reset(mark)
566 if cut: return None
567 return None
568
569 @memoize
570 def target_atoms(self) -> Optional[str]:

Callers 2

rulenameMethod · 0.95
named_itemMethod · 0.95

Calls 3

target_atomsMethod · 0.95
expectMethod · 0.45
_resetMethod · 0.45

Tested by

no test coverage detected