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

Function _make_help_call

IPython/core/inputtransformer2.py:302–316  ·  view source on GitHub ↗

Prepares a pinfo(2)/psearch call from a target name and the escape (i.e. ? or ??)

(target, esc, next_input=None)

Source from the content-addressed store, hash-verified

300ESCAPE_DOUBLES = {'!!', '??'} # %% (cell magic) is handled separately
301
302def _make_help_call(target, esc, next_input=None):
303 """Prepares a pinfo(2)/psearch call from a target name and the escape
304 (i.e. ? or ??)"""
305 method = 'pinfo2' if esc == '??' \
306 else 'psearch' if '*' in target \
307 else 'pinfo'
308 arg = " ".join([method, target])
309 #Prepare arguments for get_ipython().run_line_magic(magic_name, magic_args)
310 t_magic_name, _, t_magic_arg_s = arg.partition(' ')
311 t_magic_name = t_magic_name.lstrip(ESC_MAGIC)
312 if next_input is None:
313 return 'get_ipython().run_line_magic(%r, %r)' % (t_magic_name, t_magic_arg_s)
314 else:
315 return 'get_ipython().set_next_input(%r);get_ipython().run_line_magic(%r, %r)' % \
316 (next_input, t_magic_name, t_magic_arg_s)
317
318def _tr_help(content):
319 """Translate lines escaped with: ?

Callers 3

_tr_helpFunction · 0.70
_tr_help2Function · 0.70
transformMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected