Prepares a pinfo(2)/psearch call from a target name and the escape (i.e. ? or ??)
(target, esc, lspace, next_input=None)
| 194 | |
| 195 | # Utilities |
| 196 | def _make_help_call(target, esc, lspace, next_input=None): |
| 197 | """Prepares a pinfo(2)/psearch call from a target name and the escape |
| 198 | (i.e. ? or ??)""" |
| 199 | method = 'pinfo2' if esc == '??' \ |
| 200 | else 'psearch' if '*' in target \ |
| 201 | else 'pinfo' |
| 202 | arg = " ".join([method, target]) |
| 203 | #Prepare arguments for get_ipython().run_line_magic(magic_name, magic_args) |
| 204 | t_magic_name, _, t_magic_arg_s = arg.partition(' ') |
| 205 | t_magic_name = t_magic_name.lstrip(ESC_MAGIC) |
| 206 | if next_input is None: |
| 207 | return '%sget_ipython().run_line_magic(%r, %r)' % (lspace, t_magic_name, t_magic_arg_s) |
| 208 | else: |
| 209 | return '%sget_ipython().set_next_input(%r);get_ipython().run_line_magic(%r, %r)' % \ |
| 210 | (lspace, next_input, t_magic_name, t_magic_arg_s) |
| 211 | |
| 212 | # These define the transformations for the different escape characters. |
| 213 | def _tr_system(line_info): |