MCPcopy Index your code
hub / github.com/RustPython/RustPython / push

Method push

Lib/_pyrepl/input.py:80–105  ·  view source on GitHub ↗
(self, evt)

Source from the content-addressed store, hash-verified

78 self.stack = []
79
80 def push(self, evt):
81 if self.verbose:
82 print("pushed", evt.data, end="")
83 key = evt.data
84 d = self.k.get(key)
85 if isinstance(d, dict):
86 if self.verbose:
87 print("transition")
88 self.stack.append(key)
89 self.k = d
90 else:
91 if d is None:
92 if self.verbose:
93 print("invalid")
94 if self.stack or len(key) > 1 or unicodedata.category(key) == "C":
95 self.results.append((self.invalid_cls, self.stack + [key]))
96 else:
97 # small optimization:
98 self.k[key] = self.character_cls
99 self.results.append((self.character_cls, [key]))
100 else:
101 if self.verbose:
102 print("matched", d)
103 self.results.append((d, self.stack + [key]))
104 self.stack = []
105 self.k = self.ck
106
107 def get(self):
108 if self.results:

Callers

nothing calls this directly

Calls 6

isinstanceFunction · 0.85
lenFunction · 0.85
categoryMethod · 0.80
printFunction · 0.50
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected