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

Class FrameInfo

IPython/core/tbtools.py:284–373  ·  view source on GitHub ↗

Mirror of stack data's FrameInfo, but so that we can bypass highlighting on really long frames.

Source from the content-addressed store, hash-verified

282
283
284class FrameInfo:
285 """
286 Mirror of stack data's FrameInfo, but so that we can bypass highlighting on
287 really long frames.
288 """
289
290 description: Optional[str]
291 filename: Optional[str]
292 lineno: int
293 # number of context lines to use
294 context: Optional[int]
295 raw_lines: list[str]
296 _sd: stack_data.core.FrameInfo
297 frame: Any
298
299 @classmethod
300 def _from_stack_data_FrameInfo(
301 cls, frame_info: stack_data.core.FrameInfo | stack_data.core.RepeatedFrames
302 ) -> "FrameInfo":
303 return cls(
304 getattr(frame_info, "description", None),
305 getattr(frame_info, "filename", None), # type: ignore[arg-type]
306 getattr(frame_info, "lineno", None), # type: ignore[arg-type]
307 getattr(frame_info, "frame", None),
308 getattr(frame_info, "code", None),
309 sd=frame_info,
310 context=None,
311 )
312
313 def __init__(
314 self,
315 description: Optional[str],
316 filename: str,
317 lineno: int,
318 frame: Any,
319 code: Optional[types.CodeType],
320 *,
321 sd: Any = None,
322 context: int | None = None,
323 ):
324 assert isinstance(lineno, (int, type(None))), lineno
325 self.description = description
326 self.filename = filename
327 self.lineno = lineno
328 self.frame = frame
329 self.code = code
330 self._sd = sd
331 self.context = context
332
333 # self.lines = []
334 if sd is None:
335 try:
336 # return a list of source lines and a starting line number
337 self.raw_lines = inspect.getsourcelines(frame)[0]
338 except OSError:
339 self.raw_lines = [
340 "'Could not get source, probably due dynamically evaluated source code.'"
341 ]

Callers 1

get_recordsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…