MCPcopy Create free account
hub / github.com/ipython/ipython / lex_document

Method lex_document

IPython/terminal/ptutils.py:181–195  ·  view source on GitHub ↗
(self, document)

Source from the content-addressed store, hash-verified

179 }
180
181 def lex_document(self, document):
182 text = document.text.lstrip()
183
184 lexer = self.python_lexer
185
186 if text.startswith('!') or text.startswith('%%bash'):
187 lexer = self.shell_lexer
188
189 elif text.startswith('%%'):
190 for magic, l in self.magic_lexers.items():
191 if text.startswith('%%' + magic):
192 lexer = l
193 break
194
195 return lexer.lex_document(document)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected