emacs-ipython-notebook/ein.py
2012-06-03 17:50:13 +02:00

32 lines
1 KiB
Python

"""
Python utilities to use it from ein.el
Copyright (C) 2012- Takafumi Arakaki
Author: Takafumi Arakaki
ein.py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ein.py is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ein.py. If not, see <http://www.gnu.org/licenses/>.
"""
def find_source(name):
"""Given an object as string, `name`, print its place in source code."""
from IPython.core.interactiveshell import InteractiveShell
inst = InteractiveShell.instance()
ret = inst._find_edit_target(name, {}, [])
if ret:
(filename, lineno, use_temp) = ret
print filename
print lineno