#3 Open
mforbes mforbes
robertkern robertkern

Add support for IPython cell blocks.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

hg update 
hg pull -r default https://bitbucket.org/mforbes/line_profiler
  1. Michael Forbes avatarMichael Forbes

This PR provides one additional fallback if the source file cannot be found - it tries to read the input from the IPython input history. This seems to work quite well for cell blocks, and allows profiling of functions defined in a notebook for example without requiring one to save the cells to a file.

Comments (2)

  1. Robert Kern repo owner

    Cool! We shouldn't need to pass around the IPython shell object. IPython helpfully stuffs linecache with the appropriate code. We just need to handle the actual-file case specially to use linecache.updatecache(filename) to make sure we have a fresh copy. Other than that, the rest of the code should work.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.