DebugClients/Python/PyProfile.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1509
c0b5e693b0eb
--- a/DebugClients/Python/PyProfile.py	Fri Mar 11 08:55:14 2011 +0100
+++ b/DebugClients/Python/PyProfile.py	Fri Mar 11 16:51:57 2011 +0100
@@ -12,13 +12,14 @@
 import atexit
 import pickle
 
+
 class PyProfile(profile.Profile):
     """
     Class extending the standard Python profiler with additional methods.
     
     This class extends the standard Python profiler by the functionality to
     save the collected timing data in a timing cache, to restore these data
-    on subsequent calls, to store a profile dump to a standard filename and 
+    on subsequent calls, to store a profile dump to a standard filename and
     to erase these caches.
     """
     def __init__(self, basename, timer=None, bias=None):
@@ -113,7 +114,7 @@
         """
         # get module name from __file__
         if not isinstance(frame, profile.Profile.fake_frame) and \
-            frame.f_globals.has_key('__file__'):
+            '__file__' in frame.f_globals:
             root, ext = os.path.splitext(frame.f_globals['__file__'])
             if ext == '.pyc' or ext == '.py':
                 fixedName = root + '.py'
@@ -144,7 +145,7 @@
             fcode.co_firstlineno, fcode.co_name)
         self.cur = (t, 0, 0, fn, frame, self.cur)
         timings = self.timings
-        if timings.has_key(fn):
+        if fn in timings:
             cc, ns, tt, ct, callers = timings[fn]
             timings[fn] = cc, ns + 1, tt, ct, callers
         else:

eric ide

mercurial