|
5 | 5 | from typing import get_type_hints, TypeVar, Any, AnyStr, Tuple
|
6 | 6 |
|
7 | 7 | from sphinx.util import logging
|
8 |
| -from sphinx.util.inspect import Signature |
| 8 | +from sphinx.util.inspect import signature as Signature |
| 9 | +from sphinx.util.inspect import stringify_signature |
9 | 10 |
|
10 | 11 | logger = logging.getLogger(__name__)
|
11 | 12 | pydata_annotations = {'Any', 'AnyStr', 'Callable', 'ClassVar', 'Literal', 'NoReturn', 'Optional',
|
@@ -161,7 +162,7 @@ def process_signature(app, what: str, name: str, obj, options, signature, return
|
161 | 162 | signature = Signature(obj)
|
162 | 163 | parameters = [
|
163 | 164 | param.replace(annotation=inspect.Parameter.empty)
|
164 |
| - for param in signature.signature.parameters.values() |
| 165 | + for param in signature.parameters.values() |
165 | 166 | ]
|
166 | 167 |
|
167 | 168 | if '<locals>' in obj.__qualname__:
|
@@ -190,11 +191,11 @@ def process_signature(app, what: str, name: str, obj, options, signature, return
|
190 | 191 | if not isinstance(method_object, (classmethod, staticmethod)):
|
191 | 192 | del parameters[0]
|
192 | 193 |
|
193 |
| - signature.signature = signature.signature.replace( |
| 194 | + signature = signature.replace( |
194 | 195 | parameters=parameters,
|
195 | 196 | return_annotation=inspect.Signature.empty)
|
196 | 197 |
|
197 |
| - return signature.format_args().replace('\\', '\\\\'), None |
| 198 | + return stringify_signature(signature).replace('\\', '\\\\'), None |
198 | 199 |
|
199 | 200 |
|
200 | 201 | def get_all_type_hints(obj, name):
|
|
0 commit comments