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

Method find

IPython/core/inputtransformer2.py:430–440  ·  view source on GitHub ↗

Find the first help command (foo?) in the cell.

(cls, tokens_by_line)

Source from the content-addressed store, hash-verified

428
429 @classmethod
430 def find(cls, tokens_by_line):
431 """Find the first help command (foo?) in the cell.
432 """
433 for line in tokens_by_line:
434 # Last token is NEWLINE; look at last but one
435 if len(line) > 2 and line[-2].string == '?':
436 # Find the first token that's not INDENT/DEDENT
437 ix = 0
438 while line[ix].type in {tokenize.INDENT, tokenize.DEDENT}:
439 ix += 1
440 return cls(line[ix].start, line[-2].start)
441
442 def transform(self, lines):
443 """Transform a help command found by the ``find()`` classmethod.

Callers 15

test_functionFunction · 0.45
test_attrsFunction · 0.45
syntax_error_transformerFunction · 0.45
validateMethod · 0.45
__call__Method · 0.45
magic_config_matchesMethod · 0.45
transformerMethod · 0.45
check_findFunction · 0.45
parse_breakpointFunction · 0.45
load_nextFunction · 0.45
process_outputMethod · 0.45

Calls

no outgoing calls

Tested by 8

test_functionFunction · 0.36
test_attrsFunction · 0.36
syntax_error_transformerFunction · 0.36
transformerMethod · 0.36
check_findFunction · 0.36
testMethod · 0.36
loadTestsFromModuleMethod · 0.36
makeTestMethod · 0.36