Skip to content

Commit faaf564

Browse files
committed
update arg names in doc decorator
1 parent b4bf49b commit faaf564

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

pandas/util/_decorators.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]:
329329
return decorate
330330

331331

332-
def doc(*supplements: Union[str, Callable], **substitutes: str) -> Callable[[F], F]:
332+
def doc(*docstrings: Union[str, Callable], **params: str) -> Callable[[F], F]:
333333
"""
334334
A decorator take docstring templates, concatenate them and perform string
335335
substitution on it.
@@ -342,39 +342,39 @@ def doc(*supplements: Union[str, Callable], **substitutes: str) -> Callable[[F],
342342
343343
Parameters
344344
----------
345-
*supplements : str or callable
345+
*docstrings : str or callable
346346
The string / docstring / docstring template to be appended in order
347347
after default docstring under callable.
348-
**substitutes : str
348+
**params : str
349349
The string which would be used to format docstring template.
350350
"""
351351

352-
def decorator(call: F) -> F:
352+
def decorator(decorated: F) -> F:
353353
# collecting docstring and docstring templates
354354
docstring_components: List[Union[str, Callable]] = []
355-
if call.__doc__:
356-
docstring_components.append(dedent(call.__doc__))
355+
if decorated.__doc__:
356+
docstring_components.append(dedent(decorated.__doc__))
357357

358-
for supplement in supplements:
359-
if hasattr(supplement, "_docstring_components"):
358+
for docstring in docstrings:
359+
if hasattr(docstring, "_docstring_components"):
360360
docstring_components.extend(
361-
supplement._docstring_components # type: ignore
361+
docstring._docstring_components # type: ignore
362362
)
363-
elif isinstance(supplement, str) or supplement.__doc__:
364-
docstring_components.append(supplement)
363+
elif isinstance(docstring, str) or docstring.__doc__:
364+
docstring_components.append(docstring)
365365

366366
# formatting templates and concatenating docstring
367-
call.__doc__ = "".join(
367+
decorated.__doc__ = "".join(
368368
[
369-
component.format(**substitutes)
369+
component.format(**params)
370370
if isinstance(component, str)
371371
else dedent(component.__doc__ or "")
372372
for component in docstring_components
373373
]
374374
)
375375

376-
call._docstring_components = docstring_components # type: ignore
377-
return call
376+
decorated._docstring_components = docstring_components # type: ignore
377+
return decorated
378378

379379
return decorator
380380

0 commit comments

Comments
 (0)