Show More
@@ -169,28 +169,28 b' def _format_traceback_lines(lines, Colors, has_colors, lvals):' | |||||
169 | return res |
|
169 | return res | |
170 |
|
170 | |||
171 |
|
171 | |||
172 |
def _format_filename(file, Color |
|
172 | def _format_filename(file, ColorFilename, ColorNormal): | |
173 | """ |
|
173 | """ | |
174 |
Format filename lines with `In [n]` if it's the nth code cell or `File *.py` if it's a module. |
|
174 | Format filename lines with `In [n]` if it's the nth code cell or `File *.py` if it's a module. | |
175 |
|
175 | |||
176 | Parameters |
|
176 | Parameters | |
177 | ---------- |
|
177 | ---------- | |
178 | file : str |
|
178 | file : str | |
179 |
Color |
|
179 | ColorFilename | |
180 | ColorScheme used. |
|
180 | ColorScheme's filename coloring to be used. | |
181 |
Color |
|
181 | ColorNormal | |
182 | ColorScheme's normal coloring to be used. |
|
182 | ColorScheme's normal coloring to be used. | |
183 | """ |
|
183 | """ | |
184 | ipinst = get_ipython() |
|
184 | ipinst = get_ipython() | |
185 |
|
185 | |||
186 | if ipinst is not None and file in ipinst.compile._filename_map: |
|
186 | if ipinst is not None and file in ipinst.compile._filename_map: | |
187 | file = "[%s]" % ipinst.compile._filename_map[file] |
|
187 | file = "[%s]" % ipinst.compile._filename_map[file] | |
188 |
tpl_link = "In %s%%s%s" % (Color |
|
188 | tpl_link = "In %s%%s%s" % (ColorFilename, ColorNormal) | |
189 | else: |
|
189 | else: | |
190 | file = util_path.compress_user( |
|
190 | file = util_path.compress_user( | |
191 | py3compat.cast_unicode(file, util_path.fs_encoding) |
|
191 | py3compat.cast_unicode(file, util_path.fs_encoding) | |
192 | ) |
|
192 | ) | |
193 |
tpl_link = "File %s%%s%s" % (Color |
|
193 | tpl_link = "File %s%%s%s" % (ColorFilename, ColorNormal) | |
194 |
|
194 | |||
195 | return tpl_link % file |
|
195 | return tpl_link % file | |
196 |
|
196 | |||
@@ -440,7 +440,7 b' class ListTB(TBTools):' | |||||
440 | list = [] |
|
440 | list = [] | |
441 | for filename, lineno, name, line in extracted_list[:-1]: |
|
441 | for filename, lineno, name, line in extracted_list[:-1]: | |
442 | item = " %s, line %s%d%s, in %s%s%s\n" % ( |
|
442 | item = " %s, line %s%d%s, in %s%s%s\n" % ( | |
443 |
_format_filename(filename, Colors, Colors. |
|
443 | _format_filename(filename, Colors.filename, Colors.Normal), | |
444 | Colors.lineno, |
|
444 | Colors.lineno, | |
445 | lineno, |
|
445 | lineno, | |
446 | Colors.Normal, |
|
446 | Colors.Normal, | |
@@ -455,7 +455,7 b' class ListTB(TBTools):' | |||||
455 | filename, lineno, name, line = extracted_list[-1] |
|
455 | filename, lineno, name, line = extracted_list[-1] | |
456 | item = "%s %s, line %s%d%s, in %s%s%s%s\n" % ( |
|
456 | item = "%s %s, line %s%d%s, in %s%s%s%s\n" % ( | |
457 | Colors.normalEm, |
|
457 | Colors.normalEm, | |
458 | _format_filename(filename, Colors, Colors.normalEm), |
|
458 | _format_filename(filename, Colors.filenameEm, Colors.normalEm), | |
459 | Colors.linenoEm, |
|
459 | Colors.linenoEm, | |
460 | lineno, |
|
460 | lineno, | |
461 | Colors.normalEm, |
|
461 | Colors.normalEm, | |
@@ -504,7 +504,7 b' class ListTB(TBTools):' | |||||
504 | "%s %s, line %s%s%s\n" |
|
504 | "%s %s, line %s%s%s\n" | |
505 | % ( |
|
505 | % ( | |
506 | Colors.normalEm, |
|
506 | Colors.normalEm, | |
507 | _format_filename(value.filename, Colors, Colors.normalEm), |
|
507 | _format_filename(value.filename, Colors.filenameEm, Colors.normalEm), | |
508 | Colors.linenoEm, |
|
508 | Colors.linenoEm, | |
509 | lineno, |
|
509 | lineno, | |
510 | Colors.Normal, |
|
510 | Colors.Normal, | |
@@ -634,7 +634,7 b' class VerboseTB(TBTools):' | |||||
634 | (Colors.vName, Colors.valEm, ColorsNormal) |
|
634 | (Colors.vName, Colors.valEm, ColorsNormal) | |
635 | tpl_name_val = '%%s %s= %%s%s' % (Colors.valEm, ColorsNormal) |
|
635 | tpl_name_val = '%%s %s= %%s%s' % (Colors.valEm, ColorsNormal) | |
636 |
|
636 | |||
637 | link = _format_filename(frame_info.filename, Colors, ColorsNormal) |
|
637 | link = _format_filename(frame_info.filename, Colors.filenameEm, ColorsNormal) | |
638 | args, varargs, varkw, locals_ = inspect.getargvalues(frame_info.frame) |
|
638 | args, varargs, varkw, locals_ = inspect.getargvalues(frame_info.frame) | |
639 |
|
639 | |||
640 | func = frame_info.executing.code_qualname() |
|
640 | func = frame_info.executing.code_qualname() |
General Comments 0
You need to be logged in to leave comments.
Login now