@@ -245,7 +245,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]:
245245 return decorate
246246
247247
248- def doc (* supplements : Union [str , Callable ], ** substitutes : str ) -> Callable [[F ], F ]:
248+ def doc (* docstrings : Union [str , Callable ], ** params : str ) -> Callable [[F ], F ]:
249249 """
250250 A decorator take docstring templates, concatenate them and perform string
251251 substitution on it.
@@ -258,39 +258,39 @@ def doc(*supplements: Union[str, Callable], **substitutes: str) -> Callable[[F],
258258
259259 Parameters
260260 ----------
261- *supplements : str or callable
261+ *docstrings : str or callable
262262 The string / docstring / docstring template to be appended in order
263263 after default docstring under callable.
264- **substitutes : str
264+ **params : str
265265 The string which would be used to format docstring template.
266266 """
267267
268- def decorator (call : F ) -> F :
268+ def decorator (decorated : F ) -> F :
269269 # collecting docstring and docstring templates
270270 docstring_components : List [Union [str , Callable ]] = []
271- if call .__doc__ :
272- docstring_components .append (dedent (call .__doc__ ))
271+ if decorated .__doc__ :
272+ docstring_components .append (dedent (decorated .__doc__ ))
273273
274- for supplement in supplements :
275- if hasattr (supplement , "_docstring_components" ):
274+ for docstring in docstrings :
275+ if hasattr (docstring , "_docstring_components" ):
276276 docstring_components .extend (
277- supplement ._docstring_components # type: ignore
277+ docstring ._docstring_components # type: ignore
278278 )
279- elif isinstance (supplement , str ) or supplement .__doc__ :
280- docstring_components .append (supplement )
279+ elif isinstance (docstring , str ) or docstring .__doc__ :
280+ docstring_components .append (docstring )
281281
282282 # formatting templates and concatenating docstring
283- call .__doc__ = "" .join (
283+ decorated .__doc__ = "" .join (
284284 [
285- component .format (** substitutes )
285+ component .format (** params )
286286 if isinstance (component , str )
287287 else dedent (component .__doc__ or "" )
288288 for component in docstring_components
289289 ]
290290 )
291291
292- call ._docstring_components = docstring_components # type: ignore
293- return call
292+ decorated ._docstring_components = docstring_components # type: ignore
293+ return decorated
294294
295295 return decorator
296296
0 commit comments