Debian Codegraph @

IPython/utils/generics.py

raw
1 # encoding: utf-8
2 """Generic functions for extending IPython."""
3
4 from __future__ import annotations
5
6 from typing import Any
7
8 from IPython.core.error import TryNext
9 from functools import singledispatch
10
11
12 @singledispatch
13 def inspect_object(obj: Any) -> None:
14 """Called when you do obj?"""
15 raise TryNext
16
17
18 @singledispatch
19 def complete_object(obj: Any, prev_completions: list[str]) -> list[str]:
20 """Custom completer dispatching for python objects.
21
22 Parameters
23 ----------
24 obj : object
25 The object to complete.
26 prev_completions : list
27 List of attributes discovered so far.
28 This should return the list of attributes in obj. If you only wish to
29 add to the attributes already discovered normally, return
30 own_attrs + prev_completions.
31 """
32 raise TryNext