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

Function ends_in_comment_or_string

IPython/core/inputtransformer.py:324–339  ·  view source on GitHub ↗

Indicates whether or not an input line ends in a comment or within a multiline string. Parameters ---------- src : string A single line input string. Returns ------- comment : bool True if source ends in a comment or multiline string.

(src)

Source from the content-addressed store, hash-verified

322 return (tokenize.COMMENT in _line_tokens(src))
323
324def ends_in_comment_or_string(src):
325 """Indicates whether or not an input line ends in a comment or within
326 a multiline string.
327
328 Parameters
329 ----------
330 src : string
331 A single line input string.
332
333 Returns
334 -------
335 comment : bool
336 True if source ends in a comment or multiline string.
337 """
338 toktypes = _line_tokens(src)
339 return (tokenize.COMMENT in toktypes) or (_MULTILINE_STRING in toktypes)
340
341
342@StatelessInputTransformer.wrap

Callers 1

help_endFunction · 0.85

Calls 1

_line_tokensFunction · 0.85

Tested by

no test coverage detected