@@ -245,7 +245,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]:
245
245
return decorate
246
246
247
247
248
- def doc (* args : Union [str , Callable ], ** kwargs : str ) -> Callable [[F ], F ]:
248
+ def doc (* args : Union [str , Callable ], ** kwargs : str ) -> Callable [[Callable ], Callable ]:
249
249
"""
250
250
A decorator take docstring templates, concatenate them and perform string
251
251
substitution on it.
@@ -265,11 +265,11 @@ def doc(*args: Union[str, Callable], **kwargs: str) -> Callable[[F], F]:
265
265
The string which would be used to format docstring template.
266
266
"""
267
267
268
- def decorator (func : F ) -> F :
268
+ def decorator (call : Callable ) -> Callable :
269
269
# collecting docstring and docstring templates
270
270
docstring_components : List [Union [str , Callable ]] = []
271
- if func .__doc__ :
272
- docstring_components .append (dedent (func .__doc__ ))
271
+ if call .__doc__ :
272
+ docstring_components .append (dedent (call .__doc__ ))
273
273
274
274
for appender in args :
275
275
if hasattr (appender , "_docstring_components" ):
@@ -280,7 +280,7 @@ def decorator(func: F) -> F:
280
280
docstring_components .append (appender )
281
281
282
282
# formatting templates and concatenating docstring
283
- func .__doc__ = "" .join (
283
+ call .__doc__ = "" .join (
284
284
[
285
285
component .format (** kwargs )
286
286
if isinstance (component , str )
@@ -290,7 +290,7 @@ def decorator(func: F) -> F:
290
290
)
291
291
292
292
func ._docstring_components = docstring_components # type: ignore
293
- return func
293
+ return call
294
294
295
295
return decorator
296
296
0 commit comments