From 716093939b93777d45804122a6cf198c2a00e3f4 2009-07-01 23:25:06 From: Brian Granger Date: 2009-07-01 23:25:06 Subject: [PATCH] Debugger.py => core/debugger.py and updated all imports. --- diff --git a/IPython/Extensions/ipy_profile_zope.py b/IPython/Extensions/ipy_profile_zope.py index 172853c..72bce20 100644 --- a/IPython/Extensions/ipy_profile_zope.py +++ b/IPython/Extensions/ipy_profile_zope.py @@ -278,7 +278,8 @@ class ZopeDebug(object): zope_debug = None def ipy_set_trace(): - import IPython; IPython.Debugger.Pdb().set_trace() + from IPython.core import debugger + debugger.Pdb().set_trace() def main(): global zope_debug diff --git a/IPython/Extensions/ipy_pydb.py b/IPython/Extensions/ipy_pydb.py index ee30523..1d63bfd 100644 --- a/IPython/Extensions/ipy_pydb.py +++ b/IPython/Extensions/ipy_pydb.py @@ -3,7 +3,7 @@ import IPython.ipapi from IPython.genutils import arg_split ip = IPython.ipapi.get() -from IPython import Debugger +from IPython.core import debugger def call_pydb(self, args): """Invoke pydb with the supplied parameters.""" @@ -18,7 +18,7 @@ def call_pydb(self, args): argl = arg_split(args) # print argl # dbg if len(inspect.getargspec(pydb.runv)[0]) == 2: - pdb = Debugger.Pdb(color_scheme=self.rc.colors) + pdb = debugger.Pdb(color_scheme=self.rc.colors) ip.IP.history_saving_wrapper( lambda : pydb.runv(argl, pdb) )() else: ip.IP.history_saving_wrapper( lambda : pydb.runv(argl) )() diff --git a/IPython/Magic.py b/IPython/Magic.py index ecb5f9d..6de8d71 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -43,7 +43,8 @@ except ImportError: # Homebrewed import IPython -from IPython import Debugger, OInspect, wildcard +from IPython import OInspect, wildcard +from IPython.core import debugger from IPython.FakeModule import FakeModule from IPython.Itpl import Itpl, itpl, printpl,itplns from IPython.PyColorize import Parser @@ -1621,7 +1622,7 @@ Currently the magic system has the following functions:\n""" stats = self.magic_prun('',0,opts,arg_lst,prog_ns) else: if opts.has_key('d'): - deb = Debugger.Pdb(self.shell.rc.colors) + deb = debugger.Pdb(self.shell.rc.colors) # reset Breakpoint state, which is moronically kept # in a class bdb.Breakpoint.next = 1 diff --git a/IPython/Debugger.py b/IPython/core/debugger.py similarity index 98% rename from IPython/Debugger.py rename to IPython/core/debugger.py index 3223c7b..5b68a10 100644 --- a/IPython/Debugger.py +++ b/IPython/core/debugger.py @@ -94,7 +94,7 @@ class Tracer(object): Usage example: - from IPython.Debugger import Tracer; debug_here = Tracer() + from IPython.core.debugger import Tracer; debug_here = Tracer() ... later in your code debug_here() # -> will open up the debugger at that point. diff --git a/IPython/core/tests/test_imports.py b/IPython/core/tests/test_imports.py index e9752d1..dbe047a 100644 --- a/IPython/core/tests/test_imports.py +++ b/IPython/core/tests/test_imports.py @@ -6,3 +6,6 @@ def test_import_completer(): def test_import_crashhandler(): from IPython.core import crashhandler + +def test_import_debugger(): + from IPython.core import debugger \ No newline at end of file diff --git a/IPython/iplib.py b/IPython/iplib.py index e49816a..3d807c6 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -45,7 +45,8 @@ import tempfile # IPython's own modules #import IPython -from IPython import Debugger,OInspect,PyColorize,ultraTB +from IPython import OInspect,PyColorize,ultraTB +from IPython.core import debugger from IPython.Extensions import pickleshare from IPython.FakeModule import FakeModule, init_fakemod_dict from IPython.Itpl import ItplNS @@ -1673,7 +1674,7 @@ class InteractiveShell(object,Magic): return # use pydb if available - if Debugger.has_pydb: + if debugger.has_pydb: from pydb import pm else: # fallback to our internal debugger diff --git a/IPython/kernel/core/ultraTB.py b/IPython/kernel/core/ultraTB.py index c76aa25..71ea479 100644 --- a/IPython/kernel/core/ultraTB.py +++ b/IPython/kernel/core/ultraTB.py @@ -90,7 +90,8 @@ from inspect import getsourcefile, getfile, getmodule,\ # IPython's own modules # Modified pdb which doesn't damage IPython's readline handling -from IPython import Debugger, PyColorize +from IPython import PyColorize +from IPython.core import debugger from IPython.ipstruct import Struct from IPython.excolors import exception_colors from IPython.genutils import Term,uniq_stable,error,info @@ -322,7 +323,7 @@ class TBTools: self.old_scheme = color_scheme # save initial value for toggles if call_pdb: - self.pdb = Debugger.Pdb(self.color_scheme_table.active_scheme_name) + self.pdb = debugger.Pdb(self.color_scheme_table.active_scheme_name) else: self.pdb = None @@ -847,7 +848,7 @@ class VerboseTB(TBTools): if force or self.call_pdb: if self.pdb is None: - self.pdb = Debugger.Pdb( + self.pdb = debugger.Pdb( self.color_scheme_table.active_scheme_name) # the system displayhook may have changed, restore the original # for pdb diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 7c44267..a48ba0a 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -199,7 +199,7 @@ def make_runners(): # decorator. See ticket https://bugs.launchpad.net/bugs/366209 top_mod = \ ['backgroundjobs.py', 'coloransi.py', 'completer.py', 'configloader.py', - 'crashhandler.py', 'Debugger.py', 'deep_reload.py', 'demo.py', + 'crashhandler.py', 'debugger.py', 'deep_reload.py', 'demo.py', 'DPyGetOpt.py', 'dtutils.py', 'excolors.py', 'FakeModule.py', 'generics.py', 'genutils.py', 'history.py', 'hooks.py', 'ipapi.py', 'iplib.py', 'ipmaker.py', 'ipstruct.py', 'Itpl.py', diff --git a/IPython/ultraTB.py b/IPython/ultraTB.py index a11a0eb..c230354 100644 --- a/IPython/ultraTB.py +++ b/IPython/ultraTB.py @@ -90,7 +90,8 @@ from inspect import getsourcefile, getfile, getmodule,\ # IPython's own modules # Modified pdb which doesn't damage IPython's readline handling -from IPython import Debugger, PyColorize +from IPython import PyColorize +from IPython.core import debugger from IPython.ipstruct import Struct from IPython.excolors import exception_colors from IPython.genutils import Term,uniq_stable,error,info @@ -320,7 +321,7 @@ class TBTools: self.old_scheme = color_scheme # save initial value for toggles if call_pdb: - self.pdb = Debugger.Pdb(self.color_scheme_table.active_scheme_name) + self.pdb = debugger.Pdb(self.color_scheme_table.active_scheme_name) else: self.pdb = None @@ -837,7 +838,7 @@ class VerboseTB(TBTools): if force or self.call_pdb: if self.pdb is None: - self.pdb = Debugger.Pdb( + self.pdb = debugger.Pdb( self.color_scheme_table.active_scheme_name) # the system displayhook may have changed, restore the original # for pdb