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

Method from_item

Tools/cases_generator/stack.py:56–72  ·  view source on GitHub ↗
(item: StackItem)

Source from the content-addressed store, hash-verified

54
55 @staticmethod
56 def from_item(item: StackItem) -> "PointerOffset":
57 if not item.size:
58 return PointerOffset(1, (), ())
59 txt = item.size.strip()
60 n: tuple[str, ...] = ()
61 p: tuple[str, ...] = ()
62 try:
63 i = int(txt)
64 except ValueError:
65 i = 0
66 if txt[0] == "+":
67 txt = txt[1:]
68 if txt[0] == "-":
69 n = (txt[1:],)
70 else:
71 p = (txt,)
72 return PointerOffset(i, p, n)
73
74 @staticmethod
75 def create(numeric: int, positive: tuple[str, ...], negative: tuple[str, ...]) -> "PointerOffset":

Callers 2

popMethod · 0.80
pushMethod · 0.80

Calls 2

PointerOffsetClass · 0.85
stripMethod · 0.45

Tested by

no test coverage detected