MCPcopy Index your code
hub / github.com/prompt-toolkit/ptpython / create_ipython_grammar

Function create_ipython_grammar

src/ptpython/ipython.py:77–102  ·  view source on GitHub ↗

Return compiled IPython grammar.

()

Source from the content-addressed store, hash-verified

75
76
77def create_ipython_grammar():
78 """
79 Return compiled IPython grammar.
80 """
81 return compile(
82 r"""
83 \s*
84 (
85 (?P<percent>%)(
86 (?P<magic>pycat|run|loadpy|load) \s+ (?P<py_filename>[^\s]+) |
87 (?P<magic>cat) \s+ (?P<filename>[^\s]+) |
88 (?P<magic>pushd|cd|ls) \s+ (?P<directory>[^\s]+) |
89 (?P<magic>pdb) \s+ (?P<pdb_arg>[^\s]+) |
90 (?P<magic>autocall) \s+ (?P<autocall_arg>[^\s]+) |
91 (?P<magic>time|timeit|prun) \s+ (?P<python>.+) |
92 (?P<magic>psource|pfile|pinfo|pinfo2) \s+ (?P<python>.+) |
93 (?P<magic>system) \s+ (?P<system>.+) |
94 (?P<magic>unalias) \s+ (?P<alias_name>.+) |
95 (?P<magic>[^\s]+) .* |
96 ) .* |
97 !(?P<system>.+) |
98 (?![%!]) (?P<python>.+)
99 )
100 \s*
101 """
102 )
103
104
105def create_completer(

Callers 2

create_completerFunction · 0.85
create_lexerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected