(self, frame_lineno, lprefix=': ', context=None)
| 380 | # vds: << |
| 381 | |
| 382 | def format_stack_entry(self, frame_lineno, lprefix=': ', context=None): |
| 383 | if context is None: |
| 384 | context = self.context |
| 385 | try: |
| 386 | context=int(context) |
| 387 | if context <= 0: |
| 388 | print("Context must be a positive integer", file=self.stdout) |
| 389 | except (TypeError, ValueError): |
| 390 | print("Context must be a positive integer", file=self.stdout) |
| 391 | try: |
| 392 | import reprlib # Py 3 |
| 393 | except ImportError: |
| 394 | import repr as reprlib # Py 2 |
| 395 | |
| 396 | ret = [] |
| 397 | |
| 398 | Colors = self.color_scheme_table.active_colors |
| 399 | ColorsNormal = Colors.Normal |
| 400 | tpl_link = u'%s%%s%s' % (Colors.filenameEm, ColorsNormal) |
| 401 | tpl_call = u'%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal) |
| 402 | tpl_line = u'%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) |
| 403 | tpl_line_em = u'%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, |
| 404 | ColorsNormal) |
| 405 | |
| 406 | frame, lineno = frame_lineno |
| 407 | |
| 408 | return_value = '' |
| 409 | if '__return__' in frame.f_locals: |
| 410 | rv = frame.f_locals['__return__'] |
| 411 | #return_value += '->' |
| 412 | return_value += reprlib.repr(rv) + '\n' |
| 413 | ret.append(return_value) |
| 414 | |
| 415 | #s = filename + '(' + `lineno` + ')' |
| 416 | filename = self.canonic(frame.f_code.co_filename) |
| 417 | link = tpl_link % py3compat.cast_unicode(filename) |
| 418 | |
| 419 | if frame.f_code.co_name: |
| 420 | func = frame.f_code.co_name |
| 421 | else: |
| 422 | func = "<lambda>" |
| 423 | |
| 424 | call = '' |
| 425 | if func != '?': |
| 426 | if '__args__' in frame.f_locals: |
| 427 | args = reprlib.repr(frame.f_locals['__args__']) |
| 428 | else: |
| 429 | args = '()' |
| 430 | call = tpl_call % (func, args) |
| 431 | |
| 432 | # The level info should be generated in the same format pdb uses, to |
| 433 | # avoid breaking the pdbtrack functionality of python-mode in *emacs. |
| 434 | if frame is self.curframe: |
| 435 | ret.append('> ') |
| 436 | else: |
| 437 | ret.append(' ') |
| 438 | ret.append(u'%s(%s)%s\n' % (link,lineno,call)) |
| 439 |
no test coverage detected