Show More
@@ -334,43 +334,6 def format_argspec(argspec): | |||||
334 | return inspect.formatargspec(argspec['args'], argspec['varargs'], |
|
334 | return inspect.formatargspec(argspec['args'], argspec['varargs'], | |
335 | argspec['varkw'], argspec['defaults']) |
|
335 | argspec['varkw'], argspec['defaults']) | |
336 |
|
336 | |||
337 | @undoc |
|
|||
338 | def call_tip(oinfo, format_call=True): |
|
|||
339 | """DEPRECATED since 6.0. Extract call tip data from an oinfo dict.""" |
|
|||
340 | warnings.warn( |
|
|||
341 | "`call_tip` function is deprecated as of IPython 6.0" |
|
|||
342 | "and will be removed in future versions.", |
|
|||
343 | DeprecationWarning, |
|
|||
344 | stacklevel=2, |
|
|||
345 | ) |
|
|||
346 | # Get call definition |
|
|||
347 | argspec = oinfo.get('argspec') |
|
|||
348 | if argspec is None: |
|
|||
349 | call_line = None |
|
|||
350 | else: |
|
|||
351 | # Callable objects will have 'self' as their first argument, prune |
|
|||
352 | # it out if it's there for clarity (since users do *not* pass an |
|
|||
353 | # extra first argument explicitly). |
|
|||
354 | try: |
|
|||
355 | has_self = argspec['args'][0] == 'self' |
|
|||
356 | except (KeyError, IndexError): |
|
|||
357 | pass |
|
|||
358 | else: |
|
|||
359 | if has_self: |
|
|||
360 | argspec['args'] = argspec['args'][1:] |
|
|||
361 |
|
||||
362 | call_line = oinfo['name']+format_argspec(argspec) |
|
|||
363 |
|
||||
364 | # Now get docstring. |
|
|||
365 | # The priority is: call docstring, constructor docstring, main one. |
|
|||
366 | doc = oinfo.get('call_docstring') |
|
|||
367 | if doc is None: |
|
|||
368 | doc = oinfo.get('init_docstring') |
|
|||
369 | if doc is None: |
|
|||
370 | doc = oinfo.get('docstring','') |
|
|||
371 |
|
||||
372 | return call_line, doc |
|
|||
373 |
|
||||
374 |
|
337 | |||
375 | def _get_wrapped(obj): |
|
338 | def _get_wrapped(obj): | |
376 | """Get the original object if wrapped in one or more @decorators |
|
339 | """Get the original object if wrapped in one or more @decorators |
General Comments 0
You need to be logged in to leave comments.
Login now