IPython 8.4.0 Pypi GitHub Homepage
Other Docs

The IPython prefilter is run on all user input before it is run. The prefilter consumes lines of input and produces transformed lines of input.

The implementation consists of two phases:

  1. Transformers

  2. Checkers and handlers

Over time, we plan on deprecating the checkers and handlers and doing everything in the transformers.

The transformers are instances of PrefilterTransformer and have a single method transform that takes a line and returns a transformed line. The transformation can be accomplished using any tool, but our current ones use regular expressions for speed.

After all the transformers have been run, the line is fed to the checkers, which are instances of PrefilterChecker . The line is passed to the check method, which either returns :None:None:`None` or a PrefilterHandler instance. If :None:None:`None` is returned, the other checkers are tried. If an PrefilterHandler instance is returned, the line is passed to the handle method of the returned handler and no further checkers are tried.

Both transformers and checkers have a priority attribute, that determines the order in which they are called. Smaller priorities are tried first.

Both transformers and checkers also have :None:None:`enabled` attribute, which is a boolean that determines if the instance is used.

Users or developers can change the priority or enabled attribute of transformers or checkers, but they must call the sort_checkers or sort_transformers method after changing the priority.

Main prefilter component.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/core/prefilter.py#78
type: <class 'traitlets.traitlets.MetaHasTraits'>
Commit: