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

Method do_down

IPython/core/debugger.py:1248–1307  ·  view source on GitHub ↗

d(own) [count] Move the current frame count (default one) levels down in the stack trace (to a newer frame). Will skip hidden frames and ignored modules.

(self, arg)

Source from the content-addressed store, hash-verified

1246 )
1247
1248 def do_down(self, arg):
1249 """d(own) [count]
1250 Move the current frame count (default one) levels down in the
1251 stack trace (to a newer frame).
1252
1253 Will skip hidden frames and ignored modules.
1254 """
1255 if self.curindex + 1 == len(self.stack):
1256 self.error("Newest frame")
1257 return
1258 try:
1259 count = int(arg or 1)
1260 except ValueError:
1261 self.error("Invalid frame count (%s)" % arg)
1262 return
1263 if count < 0:
1264 _newframe = len(self.stack) - 1
1265 else:
1266 counter = 0
1267 hidden_skipped = 0
1268 module_skipped = 0
1269 hidden_frames = self.hidden_frames(self.stack)
1270
1271 for i in range(self.curindex + 1, len(self.stack)):
1272 should_skip_hidden = hidden_frames[i] and self.skip_hidden
1273 should_skip_module = self.skip and self.is_skipped_module(
1274 self.stack[i][0].f_globals.get("__name__", "")
1275 )
1276
1277 if should_skip_hidden or should_skip_module:
1278 if should_skip_hidden:
1279 hidden_skipped += 1
1280 if should_skip_module:
1281 module_skipped += 1
1282 continue
1283 counter += 1
1284 if counter >= count:
1285 break
1286 else:
1287 self.error(
1288 "all frames below skipped (hidden frames and ignored modules). Use `skip_hidden False` for hidden frames or unignore_module for ignored modules."
1289 )
1290 return
1291
1292 total_skipped = hidden_skipped + module_skipped
1293 if total_skipped:
1294 print(
1295 self.theme.format(
1296 [
1297 (
1298 Token.ExcName,
1299 f" [... skipped {total_skipped} frame(s): {hidden_skipped} hidden frames + {module_skipped} ignored modules]",
1300 ),
1301 (Token, "\n"),
1302 ]
1303 )
1304 )
1305 _newframe = i

Callers

nothing calls this directly

Calls 4

hidden_framesMethod · 0.95
errorMethod · 0.80
getMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected