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

Class NamedItem

Tools/peg_generator/pegen/grammar.py:183–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182
183class NamedItem:
184 def __init__(self, name: str | None, item: Item, type: str | None = None):
185 self.name = name
186 self.item = item
187 self.type = type
188
189 def __str__(self) -> str:
190 if not SIMPLE_STR and self.name:
191 return f"{self.name}={self.item}"
192 else:
193 return str(self.item)
194
195 def __repr__(self) -> str:
196 return f"NamedItem({self.name!r}, {self.item!r})"
197
198 def __iter__(self) -> Iterator[Item]:
199 yield self.item
200
201
202class Forced:

Callers 4

altMethod · 0.90
named_itemMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…