##// END OF EJS Templates
Remove leading empty lines...
Remove leading empty lines When running a cell, the leading indentation on the first line is removed from all of the cell's lines. This causes indentation errors on subsequent lines in case the first line consists entirely of whitespace matching a valid level of indentation that is greater than the least indented line. This change avoids the issue by first removing any leading, whitespace-only lines. Closes #11594

File last commit:

r11124:9567c77a
r25026:ded0fb17
Show More
getipython.py
24 lines | 916 B | text/x-python | PythonLexer
# encoding: utf-8
"""Simple function to call to get the current InteractiveShell instance
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
def get_ipython():
"""Get the global InteractiveShell instance.
Returns None if no InteractiveShell instance is registered.
"""
from IPython.core.interactiveshell import InteractiveShell
if InteractiveShell.initialized():
return InteractiveShell.instance()