DebugClients/Python3/BreakpointWatch.py

branch
debugger speed
changeset 5174
8c48f5e0cd92
parent 5170
fb9168c2e069
diff -r fb9168c2e069 -r 8c48f5e0cd92 DebugClients/Python3/BreakpointWatch.py
--- a/DebugClients/Python3/BreakpointWatch.py	Thu Sep 15 21:49:13 2016 +0200
+++ b/DebugClients/Python3/BreakpointWatch.py	Sun Sep 18 21:35:53 2016 +0200
@@ -29,16 +29,16 @@
     breakInFile = {}  # indexed by filename: [lineno]
     breakInFrameCache = {}
     
-    def __init__(self, filename, lineno, temporary=0, cond=None):
+    def __init__(self, filename, lineno, temporary=False, cond=None):
         """
         Constructor
         
-        @param filename the filename where a breakpoint is set
+        @param filename file name where a breakpoint is set
         @type str
-        @param lineno the line number of the breakpoint
+        @param lineno line number of the breakpoint
         @type int
         @keyparam temporary flag to indicate a temporary breakpoint
-        @type int
+        @type bool
         @keyparam cond Python expression which dynamically enables this bp
         @type str
         """
@@ -47,7 +47,7 @@
         self.line = lineno
         self.temporary = temporary
         self.cond = cond
-        self.enabled = 1
+        self.enabled = True
         self.ignore = 0
         self.hits = 0
         self.breaks[filename, lineno] = self
@@ -72,22 +72,22 @@
         """
         Public method to enable this breakpoint.
         """
-        self.enabled = 1
+        self.enabled = True
 
     def disable(self):
         """
         Public method to disable this breakpoint.
         """
-        self.enabled = 0
+        self.enabled = False
 
     @staticmethod
     def clear_break(filename, lineno):
         """
         Public method reimplemented from bdb.py to clear a breakpoint.
         
-        @param filename the filename of the bp to retrieve
+        @param filename file name of the bp to retrieve
         @type str
-        @param lineno the linenumber of the bp to retrieve
+        @param lineno line number of the bp to retrieve
         @type int
         """
         bp = Breakpoint.breaks.get((filename, lineno))
@@ -112,9 +112,9 @@
         Because eric6 supports only one breakpoint per line, this
         method will return only one breakpoint.
         
-        @param filename the filename of the bp to retrieve
+        @param filename file name of the bp to retrieve
         @type str
-        @param lineno the linenumber of the bp to retrieve
+        @param lineno line number of the bp to retrieve
         @type int
         @return Breakpoint or None, if there is no bp
         @rtype Breakpoint object or None
@@ -131,9 +131,9 @@
         location.  Returns breakpoint that was triggered and a flag
         that indicates if it is ok to delete a temporary bp.
         
-        @param filename the filename of the bp to retrieve
+        @param filename file name of the bp to retrieve
         @type str
-        @param lineno the linenumber of the bp to retrieve
+        @param lineno line number of the bp to retrieve
         @type int
         @param frame the current execution frame
         @type frame object
@@ -142,8 +142,8 @@
         @rtype tuple of Breakpoint, bool
         """
         b = Breakpoint.breaks[filename, lineno]
-        if b.enabled == 0:
-            return (None, 0)
+        if not b.enabled:
+            return (None, False)
         
         # Count every hit when bp is enabled
         b.hits += 1
@@ -152,11 +152,11 @@
             # go on to next, else break
             if b.ignore > 0:
                 b.ignore -= 1
-                return (None, 0)
+                return (None, False)
             else:
                 # breakpoint and marker that's ok
                 # to delete if temporary
-                return (b, 1)
+                return (b, True)
         else:
             # Conditional bp.
             # Ignore count applies only to those bpt hits where the
@@ -168,7 +168,7 @@
                         b.ignore -= 1
                         # continue
                     else:
-                        return (b, 1)
+                        return (b, True)
                 # else:
                 #   continue
             except Exception:
@@ -177,8 +177,8 @@
                 # regardless of ignore count.
                 # Don't delete temporary,
                 # as another hint to user.
-                return (b, 0)
-        return (None, 0)
+                return (b, False)
+        return (None, False)
 
 
 class Watch:
@@ -190,7 +190,7 @@
     """
     watches = []
 
-    def __init__(self, cond, compiledCond, flag, temporary=0):
+    def __init__(self, cond, compiledCond, flag, temporary=False):
         """
         Constructor
         
@@ -201,7 +201,7 @@
         @param flag indicates type of watch (created or changed)
         @type str
         @keyparam temporary flag for temporary watches
-        @type int
+        @type bool
         """
         # Should not occur
         if not cond:
@@ -211,7 +211,7 @@
         self.compiledCond = compiledCond
         self.temporary = temporary
         
-        self.enabled = 1
+        self.enabled = True
         self.ignore = 0
         
         self.created = False
@@ -237,13 +237,13 @@
         """
         Public method to enable this watch.
         """
-        self.enabled = 1
+        self.enabled = True
 
     def disable(self):
         """
         Public method to disable this watch.
         """
-        self.enabled = 0
+        self.enabled = False
 
     @staticmethod
     def clear_watch(cond):
@@ -291,7 +291,7 @@
         @rtype tuple of Watch, int
         """
         for b in Watch.watches:
-            if b.enabled == 0:
+            if not b.enabled:
                 continue
             try:
                 val = eval(b.compiledCond, frame.f_globals, frame.f_locals)
@@ -300,7 +300,7 @@
                         continue
                     else:
                         b.values[frame] = [1, val, b.ignore]
-                        return (b, 1)
+                        return (b, True)
                     
                 elif b.changed:
                     try:
@@ -315,17 +315,17 @@
                         b.values[frame][2] -= 1
                         continue
                     else:
-                        return (b, 1)
+                        return (b, True)
                     
                 elif val:
                     if b.ignore > 0:
                         b.ignore -= 1
                         continue
                     else:
-                        return (b, 1)
+                        return (b, True)
             except Exception:
                 continue
-        return (None, 0)
+        return (None, False)
 
 
 #

eric ide

mercurial