MCPcopy Index your code
hub / github.com/python/cpython / idle_formatwarning

Function idle_formatwarning

Lib/idlelib/run.py:51–62  ·  view source on GitHub ↗

Format warnings the IDLE way.

(message, category, filename, lineno, line=None)

Source from the content-addressed store, hash-verified

49
50
51def idle_formatwarning(message, category, filename, lineno, line=None):
52 """Format warnings the IDLE way."""
53
54 s = "\nWarning (from warnings module):\n"
55 s += f' File \"{filename}\", line {lineno}\n'
56 if line is None:
57 line = linecache.getline(filename, lineno)
58 line = line.strip()
59 if line:
60 s += " %s\n" % line
61 s += f"{category.__name__}: {message}\n"
62 return s
63
64def idle_showwarning_subproc(
65 message, category, filename, lineno, file=None, line=None):

Callers 2

idle_showwarningFunction · 0.90
idle_showwarning_subprocFunction · 0.85

Calls 2

getlineMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…