@@ -87,6 +87,7 @@ def get_annotation_args(annotation, module: str, class_name: str) -> Tuple:
87
87
def format_annotation (annotation ,
88
88
fully_qualified : bool = False ,
89
89
simplify_optional_unions : bool = True ) -> str :
90
+ print (f'formatting annotation: { annotation !r} ({ type (annotation )} )' )
90
91
# Special cases
91
92
if annotation is None or annotation is type (None ): # noqa: E721
92
93
return ':py:obj:`None`'
@@ -105,7 +106,7 @@ def format_annotation(annotation,
105
106
class_name = get_annotation_class_name (annotation , module )
106
107
args = get_annotation_args (annotation , module , class_name )
107
108
except ValueError :
108
- return str (annotation )
109
+ return str (annotation ). strip ( "'" )
109
110
110
111
# Redirect all typing_extensions types to the stdlib typing module
111
112
if module == 'typing_extensions' :
@@ -165,6 +166,8 @@ def process_signature(app, what: str, name: str, obj, options, signature, return
165
166
param .replace (annotation = inspect .Parameter .empty )
166
167
for param in signature .parameters .values ()
167
168
]
169
+ if name == 'dummy_module.function_with_unresolvable_annotation' :
170
+ print (f' parameters: { parameters } ' )
168
171
169
172
# The generated dataclass __init__() and class are weird and need extra checks
170
173
# This helper function operates on the generated class and methods
@@ -186,6 +189,8 @@ def _is_dataclass(name: str, what: str, qualname: str) -> bool:
186
189
return
187
190
188
191
if parameters :
192
+ if name == 'dummy_module.function_with_unresolvable_annotation' :
193
+ print (' formatting parameters' )
189
194
if inspect .isclass (original_obj ) or (what == 'method' and name .endswith ('.__init__' )):
190
195
del parameters [0 ]
191
196
elif what == 'method' :
@@ -209,6 +214,8 @@ def _is_dataclass(name: str, what: str, qualname: str) -> bool:
209
214
parameters = parameters ,
210
215
return_annotation = inspect .Signature .empty )
211
216
217
+ if name == 'dummy_module.function_with_unresolvable_annotation' :
218
+ print (' stringifying signature' )
212
219
return stringify_signature (signature ).replace ('\\ ' , '\\ \\ ' ), None
213
220
214
221
0 commit comments