1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
import warnings
from pyinstrument.context_manager import profile
from pyinstrument.profiler import Profiler
__all__ = ["__version__", "Profiler", "load_ipython_extension", "profile"]
__version__ = "5.1.1"
# enable deprecation warnings
warnings.filterwarnings("once", ".*", DeprecationWarning, r"pyinstrument\..*")
def load_ipython_extension(ipython):
"""
This function is called by IPython to load the pyinstrument IPython
extension, which is done with the magic command `%load_ext pyinstrument`.
"""
from pyinstrument.magic import PyinstrumentMagic
ipython.register_magics(PyinstrumentMagic)
|