MCPcopy Create free account
hub / github.com/ipython/ipython / __init__

Method __init__

IPython/core/debugger.py:103–165  ·  view source on GitHub ↗

DEPRECATED Create a local debugger instance. Parameters ---------- colors : str, optional The name of the color scheme to use, it must be one of IPython's valid color schemes. If not given, the function will default to

(self, colors=None)

Source from the content-addressed store, hash-verified

101
102 @skip_doctest
103 def __init__(self, colors=None):
104 """
105 DEPRECATED
106
107 Create a local debugger instance.
108
109 Parameters
110 ----------
111
112 colors : str, optional
113 The name of the color scheme to use, it must be one of IPython's
114 valid color schemes. If not given, the function will default to
115 the current IPython scheme when running inside IPython, and to
116 'NoColor' otherwise.
117
118 Examples
119 --------
120 ::
121
122 from IPython.core.debugger import Tracer; debug_here = Tracer()
123
124 Later in your code::
125
126 debug_here() # -> will open up the debugger at that point.
127
128 Once the debugger activates, you can use all of its regular commands to
129 step through code, set breakpoints, etc. See the pdb documentation
130 from the Python standard library for usage details.
131 """
132 warnings.warn("`Tracer` is deprecated since version 5.1, directly use "
133 "`IPython.core.debugger.Pdb.set_trace()`",
134 DeprecationWarning, stacklevel=2)
135
136 ip = get_ipython()
137 if ip is None:
138 # Outside of ipython, we set our own exception hook manually
139 sys.excepthook = functools.partial(BdbQuit_excepthook,
140 excepthook=sys.excepthook)
141 def_colors = 'NoColor'
142 else:
143 # In ipython, we use its custom exception handler mechanism
144 def_colors = ip.colors
145 ip.set_custom_exc((bdb.BdbQuit,), BdbQuit_IPython_excepthook)
146
147 if colors is None:
148 colors = def_colors
149
150 # The stdlib debugger internally uses a modified repr from the `repr`
151 # module, that limits the length of printed strings to a hardcoded
152 # limit of 30 characters. That much trimming is too aggressive, let's
153 # at least raise that limit to 80 chars, which should be enough for
154 # most interactive uses.
155 try:
156 from reprlib import aRepr
157 aRepr.maxstring = 80
158 except:
159 # This is only a user-facing convenience, so any error we encounter
160 # here can be warned about but can be otherwise ignored. These

Callers

nothing calls this directly

Calls 4

get_ipythonFunction · 0.90
PdbClass · 0.85
warnMethod · 0.80
set_custom_excMethod · 0.80

Tested by

no test coverage detected