Fixed some code style issues and removed the obsolete method shouldSkip. debugger speed

Sat, 23 Jul 2016 14:12:07 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sat, 23 Jul 2016 14:12:07 +0200
branch
debugger speed
changeset 5048
9899fb545b1f
parent 5046
d57f18f15f1a
child 5049
e1d22c4b0be0

Fixed some code style issues and removed the obsolete method shouldSkip.

DebugClients/Python/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugClientBase.py file | annotate | diff | comparison | revisions
--- a/DebugClients/Python/DebugBase.py	Wed Jul 20 22:14:24 2016 +0200
+++ b/DebugClients/Python/DebugBase.py	Sat Jul 23 14:12:07 2016 +0200
@@ -413,6 +413,7 @@
         """
         Private method to check if the function / method has a line number
         which is a breakpoint.
+        
         @param frame the frame object
         @type frame object
         @return Flag indicating a function / method with breakpoint
@@ -425,7 +426,8 @@
         except KeyError:
             filename = self.fix_frame_filename(frame)
             if filename not in Breakpoint.breakInFile:
-                Breakpoint.breakInFrameCache[frame.f_globals.get('__file__'),
+                Breakpoint.breakInFrameCache[
+                    frame.f_globals.get('__file__'),
                     frame.f_code.co_firstlineno] = False
                 return False
             lineNo = frame.f_code.co_firstlineno
@@ -442,7 +444,8 @@
                         frame.f_globals.get('__file__'),
                         frame.f_code.co_firstlineno] = True
                     return True
-            Breakpoint.breakInFrameCache[frame.f_globals.get('__file__'),
+            Breakpoint.breakInFrameCache[
+                frame.f_globals.get('__file__'),
                 frame.f_code.co_firstlineno] = False
             return False
     
--- a/DebugClients/Python/DebugClientBase.py	Wed Jul 20 22:14:24 2016 +0200
+++ b/DebugClients/Python/DebugClientBase.py	Sat Jul 23 14:12:07 2016 +0200
@@ -1267,30 +1267,6 @@
         # Nothing found.
         return fn
 
-    def shouldSkip(self, fn):
-        """
-        Public method to check if a file should be skipped.
-        
-        @param fn filename to be checked
-        @return non-zero if fn represents a file we are 'skipping',
-            zero otherwise.
-        """
-        if self.mainThread.tracePython:     # trace into Python library
-            return 0
-            
-        # Eliminate anything that is part of the Python installation.
-        afn = self.absPath(fn)
-        for d in self.skipdirs:
-            if afn.startswith(d):
-                return 1
-        
-        # special treatment for paths containing site-packages or dist-packages
-        for part in ["site-packages", "dist-packages"]:
-            if part in afn:
-                return 1
-        
-        return 0
-        
     def getRunning(self):
         """
         Public method to return the main script we are currently running.
--- a/DebugClients/Python3/DebugBase.py	Wed Jul 20 22:14:24 2016 +0200
+++ b/DebugClients/Python3/DebugBase.py	Sat Jul 23 14:12:07 2016 +0200
@@ -336,10 +336,10 @@
                     self.user_exception(frame, arg)
                     if self.quitting:
                         raise bdb.BdbQuit
-            # Stop at the StopIteration or GeneratorExit exception when the user
-            # has set stopframe in a generator by issuing a return command, or a
-            # next/until command at the last statement in the generator before the
-            # exception.
+            # Stop at the StopIteration or GeneratorExit exception when the
+            # user has set stopframe in a generator by issuing a return
+            # command, or a next/until command at the last statement in the
+            # generator before the exception.
             elif (self.stopframe and frame is not self.stopframe and
                     self.stopframe.f_code.co_flags & CO_GENERATOR and
                     arg[0] in (StopIteration, GeneratorExit)):
@@ -433,6 +433,7 @@
         """
         Private method to check if the function / method has a line number
         which is a breakpoint.
+        
         @param frame the frame object
         @type frame object
         @return Flag indicating a function / method with breakpoint
@@ -445,7 +446,8 @@
         except KeyError:
             filename = self.fix_frame_filename(frame)
             if filename not in Breakpoint.breakInFile:
-                Breakpoint.breakInFrameCache[frame.f_globals.get('__file__'),
+                Breakpoint.breakInFrameCache[
+                    frame.f_globals.get('__file__'),
                     frame.f_code.co_firstlineno] = False
                 return False
             lineNo = frame.f_code.co_firstlineno
@@ -462,7 +464,8 @@
                         frame.f_globals.get('__file__'),
                         frame.f_code.co_firstlineno] = True
                     return True
-            Breakpoint.breakInFrameCache[frame.f_globals.get('__file__'),
+            Breakpoint.breakInFrameCache[
+                frame.f_globals.get('__file__'),
                 frame.f_code.co_firstlineno] = False
             return False
     
@@ -508,8 +511,8 @@
         @type int
         """
         Breakpoint.clear_break(filename, lineno)
-        self._dbgClient.write('%s%s,%d\n' % (ResponseClearBreak, filename,
-                                             lineno))
+        self._dbgClient.write('{0}{1},{2:d}\n'.format(
+                              ResponseClearBreak, filename, lineno))
 
     def __do_clearWatch(self, cond):
         """
@@ -519,7 +522,7 @@
         @type str
         """
         Watch.clear_watch(cond)
-        self._dbgClient.write('%s%s\n' % (ResponseClearWatch, cond))
+        self._dbgClient.write('{0}{1}\n'.format(ResponseClearWatch, cond))
 
     def getStack(self):
         """
--- a/DebugClients/Python3/DebugClientBase.py	Wed Jul 20 22:14:24 2016 +0200
+++ b/DebugClients/Python3/DebugClientBase.py	Sat Jul 23 14:12:07 2016 +0200
@@ -1272,30 +1272,6 @@
         # Nothing found.
         return fn
 
-    def shouldSkip(self, fn):
-        """
-        Public method to check if a file should be skipped.
-        
-        @param fn filename to be checked
-        @return non-zero if fn represents a file we are 'skipping',
-            zero otherwise.
-        """
-        if self.mainThread.tracePython:     # trace into Python library
-            return False
-            
-        # Eliminate anything that is part of the Python installation.
-        afn = self.absPath(fn)
-        for d in self.skipdirs:
-            if afn.startswith(d):
-                return True
-        
-        # special treatment for paths containing site-packages or dist-packages
-        for part in ["site-packages", "dist-packages"]:
-            if part in afn:
-                return True
-        
-        return False
-    
     def getRunning(self):
         """
         Public method to return the main script we are currently running.

eric ide

mercurial