Source code for pymor.tools.formatsrc
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from inspect import getsource
from pymor.core.config import is_jupyter
[docs]def print_source(obj):
source = format_source(obj)
if is_jupyter():
from IPython.display import display, Code
display(source)
else:
print(source)
[docs]def source_repr(obj):
source = format_source(obj)
if is_jupyter():
from IPython.display import display, Code
display(source)
return ''
else:
return source