MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / FrameSummary

Class FrameSummary

tools/python-3.11.9-amd64/Lib/traceback.py:244–319  ·  view source on GitHub ↗

Information about a single frame from a traceback. - :attr:`filename` The filename for the frame. - :attr:`lineno` The line within filename for the frame that was active when the frame was captured. - :attr:`name` The name of the function or method that was executing w

Source from the content-addressed store, hash-verified

242
243
244class FrameSummary:
245 """Information about a single frame from a traceback.
246
247 - :attr:`filename` The filename for the frame.
248 - :attr:`lineno` The line within filename for the frame that was
249 active when the frame was captured.
250 - :attr:`name` The name of the function or method that was executing
251 when the frame was captured.
252 - :attr:`line` The text from the linecache module for the
253 of code that was running when the frame was captured.
254 - :attr:`locals` Either None if locals were not supplied, or a dict
255 mapping the name to the repr() of the variable.
256 """
257
258 __slots__ = ('filename', 'lineno', 'end_lineno', 'colno', 'end_colno',
259 'name', '_line', 'locals')
260
261 def __init__(self, filename, lineno, name, *, lookup_line=True,
262 locals=None, line=None,
263 end_lineno=None, colno=None, end_colno=None):
264 """Construct a FrameSummary.
265
266 :param lookup_line: If True, `linecache` is consulted for the source
267 code line. Otherwise, the line will be looked up when first needed.
268 :param locals: If supplied the frame locals, which will be captured as
269 object representations.
270 :param line: If provided, use this instead of looking up the line in
271 the linecache.
272 """
273 self.filename = filename
274 self.lineno = lineno
275 self.name = name
276 self._line = line
277 if lookup_line:
278 self.line
279 self.locals = {k: repr(v) for k, v in locals.items()} if locals else None
280 self.end_lineno = end_lineno
281 self.colno = colno
282 self.end_colno = end_colno
283
284 def __eq__(self, other):
285 if isinstance(other, FrameSummary):
286 return (self.filename == other.filename and
287 self.lineno == other.lineno and
288 self.name == other.name and
289 self.locals == other.locals)
290 if isinstance(other, tuple):
291 return (self.filename, self.lineno, self.name, self.line) == other
292 return NotImplemented
293
294 def __getitem__(self, pos):
295 return (self.filename, self.lineno, self.name, self.line)[pos]
296
297 def __iter__(self):
298 return iter([self.filename, self.lineno, self.name, self.line])
299
300 def __repr__(self):
301 return "<FrameSummary file {filename}, line {lineno} in {name}>".format(

Callers 2

from_listMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected