Path 1: 11 calls (0.48)

'' (5) 'Thing' (5) 'SomeClass' (1)

test_can_handle_special_characters_in_docstrings..Something def (5) test_can_handle_special_characters_in_docstrings..Something.Thing ...

Text (11)

1def _get_signature(self, name: str, obj: Any) -> Optional[Text]:
2        """Get a signature for a callable."""
3        try:
4            _signature = str(signature(obj)) + ":"
5        except ValueError:
6            _signature = "(...)"
7        except TypeError:
8            return None
9
10        source_filename: Optional[str] = None
11        try:
12            source_filename = getfile(obj)
13        except (OSError, TypeError):
14            # OSError is raised if obj has no source file, e.g. when defined in REPL.
15            pass
16
17        callable_name = Text(name, style="inspect.callable")
18        if source_filename:
19            callable_name.stylize(f"link file://{source_filename}")
20        signature_text = self.highlighter(_signature)
21
22        qualname = name or getattr(obj, "__qualname__", name)
23
24        # If obj is a module, there may be classes (which are callable) to display
25        if inspect.isclass(obj):
26            prefix = "class"
27        elif inspect.iscoroutinefunction(obj):
28            prefix = "async def"
29        else:
30            prefix = "def"
31
32        qual_signature = Text.assemble(
33            (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
34            (qualname, "inspect.callable"),
35            signature_text,
36        )
37
38        return qual_signature
            

Path 2: 5 calls (0.22)

'as_integer_ratio' (1) 'bit_count' (1) 'bit_length' (1) 'from_bytes' (1) 'to_bytes' (1)

builtin_function_or_method (5)

Text (5)

TypeError (5)

1def _get_signature(self, name: str, obj: Any) -> Optional[Text]:
2        """Get a signature for a callable."""
3        try:
4            _signature = str(signature(obj)) + ":"
5        except ValueError:
6            _signature = "(...)"
7        except TypeError:
8            return None
9
10        source_filename: Optional[str] = None
11        try:
12            source_filename = getfile(obj)
13        except (OSError, TypeError):
14            # OSError is raised if obj has no source file, e.g. when defined in REPL.
15            pass
16
17        callable_name = Text(name, style="inspect.callable")
18        if source_filename:
19            callable_name.stylize(f"link file://{source_filename}")
20        signature_text = self.highlighter(_signature)
21
22        qualname = name or getattr(obj, "__qualname__", name)
23
24        # If obj is a module, there may be classes (which are callable) to display
25        if inspect.isclass(obj):
26            prefix = "class"
27        elif inspect.iscoroutinefunction(obj):
28            prefix = "async def"
29        else:
30            prefix = "def"
31
32        qual_signature = Text.assemble(
33            (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
34            (qualname, "inspect.callable"),
35            signature_text,
36        )
37
38        return qual_signature
            

Path 3: 3 calls (0.13)

'__init__' (1) 'method' (1) 'function' (1)

Foo.__init__ def (1) Foo.method def (1) test_inspect_module_with_class..function def (1)

Text (3)

1def _get_signature(self, name: str, obj: Any) -> Optional[Text]:
2        """Get a signature for a callable."""
3        try:
4            _signature = str(signature(obj)) + ":"
5        except ValueError:
6            _signature = "(...)"
7        except TypeError:
8            return None
9
10        source_filename: Optional[str] = None
11        try:
12            source_filename = getfile(obj)
13        except (OSError, TypeError):
14            # OSError is raised if obj has no source file, e.g. when defined in REPL.
15            pass
16
17        callable_name = Text(name, style="inspect.callable")
18        if source_filename:
19            callable_name.stylize(f"link file://{source_filename}")
20        signature_text = self.highlighter(_signature)
21
22        qualname = name or getattr(obj, "__qualname__", name)
23
24        # If obj is a module, there may be classes (which are callable) to display
25        if inspect.isclass(obj):
26            prefix = "class"
27        elif inspect.iscoroutinefunction(obj):
28            prefix = "async def"
29        else:
30            prefix = "def"
31
32        qual_signature = Text.assemble(
33            (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
34            (qualname, "inspect.callable"),
35            signature_text,
36        )
37
38        return qual_signature
            

Path 4: 2 calls (0.09)

'' (1) 'conjugate' (1)

builtin_function_or_method (2)

Text (2)

TypeError (2)

1def _get_signature(self, name: str, obj: Any) -> Optional[Text]:
2        """Get a signature for a callable."""
3        try:
4            _signature = str(signature(obj)) + ":"
5        except ValueError:
6            _signature = "(...)"
7        except TypeError:
8            return None
9
10        source_filename: Optional[str] = None
11        try:
12            source_filename = getfile(obj)
13        except (OSError, TypeError):
14            # OSError is raised if obj has no source file, e.g. when defined in REPL.
15            pass
16
17        callable_name = Text(name, style="inspect.callable")
18        if source_filename:
19            callable_name.stylize(f"link file://{source_filename}")
20        signature_text = self.highlighter(_signature)
21
22        qualname = name or getattr(obj, "__qualname__", name)
23
24        # If obj is a module, there may be classes (which are callable) to display
25        if inspect.isclass(obj):
26            prefix = "class"
27        elif inspect.iscoroutinefunction(obj):
28            prefix = "async def"
29        else:
30            prefix = "def"
31
32        qual_signature = Text.assemble(
33            (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
34            (qualname, "inspect.callable"),
35            signature_text,
36        )
37
38        return qual_signature
            

Path 5: 1 calls (0.04)

'' (1)

test_inspect_coroutine..coroutine def (1)

Text (1)

1def _get_signature(self, name: str, obj: Any) -> Optional[Text]:
2        """Get a signature for a callable."""
3        try:
4            _signature = str(signature(obj)) + ":"
5        except ValueError:
6            _signature = "(...)"
7        except TypeError:
8            return None
9
10        source_filename: Optional[str] = None
11        try:
12            source_filename = getfile(obj)
13        except (OSError, TypeError):
14            # OSError is raised if obj has no source file, e.g. when defined in REPL.
15            pass
16
17        callable_name = Text(name, style="inspect.callable")
18        if source_filename:
19            callable_name.stylize(f"link file://{source_filename}")
20        signature_text = self.highlighter(_signature)
21
22        qualname = name or getattr(obj, "__qualname__", name)
23
24        # If obj is a module, there may be classes (which are callable) to display
25        if inspect.isclass(obj):
26            prefix = "class"
27        elif inspect.iscoroutinefunction(obj):
28            prefix = "async def"
29        else:
30            prefix = "def"
31
32        qual_signature = Text.assemble(
33            (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
34            (qualname, "inspect.callable"),
35            signature_text,
36        )
37
38        return qual_signature
            

Path 6: 1 calls (0.04)

'foo' (1)

test_broken_call_attr..NotCallable (1)

None (1)

TypeError (1)

1def _get_signature(self, name: str, obj: Any) -> Optional[Text]:
2        """Get a signature for a callable."""
3        try:
4            _signature = str(signature(obj)) + ":"
5        except ValueError:
6            _signature = "(...)"
7        except TypeError:
8            return None
9
10        source_filename: Optional[str] = None
11        try:
12            source_filename = getfile(obj)
13        except (OSError, TypeError):
14            # OSError is raised if obj has no source file, e.g. when defined in REPL.
15            pass
16
17        callable_name = Text(name, style="inspect.callable")
18        if source_filename:
19            callable_name.stylize(f"link file://{source_filename}")
20        signature_text = self.highlighter(_signature)
21
22        qualname = name or getattr(obj, "__qualname__", name)
23
24        # If obj is a module, there may be classes (which are callable) to display
25        if inspect.isclass(obj):
26            prefix = "class"
27        elif inspect.iscoroutinefunction(obj):
28            prefix = "async def"
29        else:
30            prefix = "def"
31
32        qual_signature = Text.assemble(
33            (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
34            (qualname, "inspect.callable"),
35            signature_text,
36        )
37
38        return qual_signature