magics
Line and cell magics for in-process notebook execution.
UsageError
def UsageError(
*args, **kwargs
):
Common base class for all non-exit exceptions.
MagicsMixin
def MagicsMixin():
MagicsMixin.init_magics
def init_magics():
MagicsMixin.register_magic_function
def register_magic_function(
func, magic_kind:str='line', magic_name=None
):
Register f(line), f(line, cell), or f(line, cell=None) as a magic.
MagicsMixin.var_expand
def var_expand(
cmd, depth:int=0, formatter:execnb.minipy.text.DollarFormatter=<DollarFormatter>
):
MagicsMixin.run_line_magic
def run_line_magic(
magic_name, line
):
MagicsMixin.run_cell_magic
def run_cell_magic(
magic_name, line, cell
):
MagicsMixin.lsmagic
def lsmagic(
line:str=''
):
List registered line and cell magics. Use -j or –json to return a dictionary.
MagicsMixin.show_usage
def show_usage():
MagicsMixin.who_ls
def who_ls(
line:str=''
):
Return sorted user variables, optionally restricted to the given type names.
MagicsMixin.who
def who(
line:str=''
):
Print user variable names, optionally restricted by type.
MagicsMixin.whos
def whos(
line:str=''
):
Show the types and values of user variables, summarizing arrays and long values.
MagicsMixin.system
def system(
cmd
):
MagicsMixin.getoutput
def getoutput(
cmd
):
MagicsMixin.pwd
def pwd(
line
):
MagicsMixin.cd
def cd(
line
):
MagicsMixin.env
def env(
line
):
Get or set a variable, or list the environment with likely secrets hidden.
MagicsMixin.set_env
def set_env(
line
):
MagicsMixin.writefile
def writefile(
line, cell
):
MagicsMixin.html
def html(
line, cell
):
MagicsMixin.capture
def capture(
line, cell
):
MagicsMixin.config
def config(
line
):
Set InlineBackend.figure_format for inline Matplotlib plots.
MagicsMixin.matplotlib
def matplotlib(
line
):
Enable inline figure display.
MagicsMixin.pinfo
def pinfo(
line
):
MagicsMixin.pinfo2
def pinfo2(
line
):
MagicsMixin.timeit
def timeit(
line:str='', cell=None, local_ns=None
):
Time a statement or cell. On %%timeit the header runs as untimed setup.
-n loops, -r repeats, -t wall time, -c process CPU time, -p significant digits, -q quiet, -o return the result, -v NAME save it.
MagicsMixin.time
def time(
line:str='', cell=None, local_ns=None
):
Print CPU and wall time and return the last expression; –no-raise-error suppresses ordinary runtime exceptions.