Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add ExecutionMagics._run_with_profiler

  • Loading branch information...
commit 6fbcf5c175e555aa845394f4ac280e847e3f6c84 1 parent 8418a7f
Takafumi Arakaki authored March 24, 2013

Showing 1 changed file with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. 12  IPython/core/magics/execution.py
12  IPython/core/magics/execution.py
@@ -77,8 +77,7 @@ def profile_missing_notice(self, *args, **kwargs):
77 77
 
78 78
     @skip_doctest
79 79
     @line_cell_magic
80  
-    def prun(self, parameter_s='', cell=None, user_mode=True,
81  
-                   opts=None,arg_lst=None,prog_ns=None, namespace=None):
  80
+    def prun(self, parameter_s='', cell=None):
82 81
 
83 82
         """Run a statement through the python code profiler.
84 83
 
@@ -178,6 +177,11 @@ def prun(self, parameter_s='', cell=None, user_mode=True,
178 177
 
179 178
           In [1]: import profile; profile.help()
180 179
         """
  180
+        return self._run_with_profiler(parameter_s, cell)
  181
+
  182
+    def _run_with_profiler(
  183
+            self, parameter_s='', cell=None, user_mode=True,
  184
+            opts=None, arg_lst=None, prog_ns=None, namespace=None):
181 185
 
182 186
         opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
183 187
 
@@ -563,7 +567,9 @@ def run(self, parameter_s='', runner=None,
563 567
             stats = None
564 568
             with self.shell.readline_no_record:
565 569
                 if 'p' in opts:
566  
-                    stats = self.prun('', code, False, opts, namespace=code_ns)
  570
+                    stats = self._run_with_profiler(
  571
+                        cell=code, user_mode=False, opts=opts,
  572
+                        namespace=code_ns)
567 573
                 else:
568 574
                     if 'd' in opts:
569 575
                         self._run_with_debugger(

0 notes on commit 6fbcf5c

Please sign in to comment.
Something went wrong with that request. Please try again.