MCPcopy
hub / github.com/prompt-toolkit/ptpython / activate_next

Method activate_next

src/ptpython/python_input.py:145–166  ·  view source on GitHub ↗

Activate next value.

(self, _previous: bool = False)

Source from the content-addressed store, hash-verified

143 return self.get_values()
144
145 def activate_next(self, _previous: bool = False) -> None:
146 """
147 Activate next value.
148 """
149 current = self.get_current_value()
150 options = sorted(self.values.keys())
151
152 # Get current index.
153 try:
154 index = options.index(current)
155 except ValueError:
156 index = 0
157
158 # Go to previous/next index.
159 if _previous:
160 index -= 1
161 else:
162 index += 1
163
164 # Call handler for this option.
165 next_option = options[index % len(options)]
166 self.values[next_option]()
167
168 def activate_previous(self) -> None:
169 """

Callers 3

activate_previousMethod · 0.95
_Function · 0.80
goto_nextFunction · 0.80

Calls 1

get_current_valueMethod · 0.80

Tested by

no test coverage detected