MCPcopy Index your code
hub / github.com/ipython/ipython / set_mode

Method set_mode

IPython/core/ultratb.py:1174–1193  ·  view source on GitHub ↗

Switch to the desired mode. If mode is not specified, cycles through the available modes.

(self, mode: Optional[str] = None)

Source from the content-addressed store, hash-verified

1172 return self.tb_join_char.join(stb)
1173
1174 def set_mode(self, mode: Optional[str] = None) -> None:
1175 """Switch to the desired mode.
1176
1177 If mode is not specified, cycles through the available modes."""
1178
1179 if not mode:
1180 new_idx = (self.valid_modes.index(self.mode) + 1) % len(self.valid_modes)
1181 self.mode = self.valid_modes[new_idx]
1182 elif mode not in self.valid_modes:
1183 raise ValueError(
1184 "Unrecognized mode in FormattedTB: <" + mode + ">\n"
1185 "Valid modes: " + str(self.valid_modes)
1186 )
1187 else:
1188 assert isinstance(mode, str)
1189 self.mode = mode
1190 # include variable details only in 'Verbose' mode
1191 self.include_vars = self.mode == self.valid_modes[2]
1192 # Set the join character for generating text tracebacks
1193 self.tb_join_char = self._join_chars[self.mode]
1194
1195 # some convenient shortcuts
1196 def plain(self) -> None:

Callers 8

__init__Method · 0.95
plainMethod · 0.95
contextMethod · 0.95
verboseMethod · 0.95
minimalMethod · 0.95
tbMethod · 0.80
xmodeMethod · 0.80

Calls 1

indexMethod · 0.80

Tested by

no test coverage detected