Prepares a pinfo(2)/psearch call from a target name and the escape (i.e. ? or ??)
(target, esc, next_input=None)
| 300 | ESCAPE_DOUBLES = {'!!', '??'} # %% (cell magic) is handled separately |
| 301 | |
| 302 | def _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 | |
| 318 | def _tr_help(content): |
| 319 | """Translate lines escaped with: ? |