Warning

This documentation covers a development version of IPython. The development version may differ significantly from the latest stable release.

Important

This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

Module: core.splitinput

Simple utility for splitting user input. This is used by both inputsplitter and prefilter.

Authors:

  • Brian Granger

  • Fernando Perez

1 Class

class IPython.core.splitinput.LineInfo(line, continue_prompt=False)

Bases: object

A single line of input and associated info.

Includes the following as properties:

line

The original, raw line

continue_prompt

Is this line a continuation in a sequence of multiline input?

pre

Any leading whitespace.

esc

The escape character(s) in pre or the empty string if there isn’t one. Note that ‘!!’ and ‘??’ are possible values for esc. Otherwise it will always be a single character.

ifun

The ‘function part’, which is basically the maximal initial sequence of valid python identifiers and the ‘.’ character. This is what is checked for alias and magic transformations, used for auto-calling, etc. In contrast to Python identifiers, it may start with “%” and contain “*”.

the_rest

Everything else on the line.

__init__(line, continue_prompt=False)

Initialize self. See help(type(self)) for accurate signature.

ofind(ip)

Do a full, attribute-walking lookup of the ifun in the various namespaces for the given IPython InteractiveShell instance.

Return a dict with keys: {found, obj, ospace, ismagic}

Note: can cause state changes because of calling getattr, but should only be run if autocall is on and if the line hasn’t matched any other, less dangerous handlers.

Does cache the results of the call, so can be called multiple times without worrying about further damaging state.

1 Function

IPython.core.splitinput.split_user_input(line, pattern=None)

Split user input into initial whitespace, escape character, function part and the rest.