Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pandas/util/_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]:
if alternative.__doc__.count("\n") < 3:
raise AssertionError(doc_error_msg)
empty1, summary, empty2, doc_string = alternative.__doc__.split("\n", 3)
if empty1 or empty2 and not summary:
if empty1 or (empty2 and not summary):
raise AssertionError(doc_error_msg)
wrapper.__doc__ = dedent(
f"""
Expand Down Expand Up @@ -211,7 +211,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]:
kwargs[new_arg_name] = new_arg_value
return func(*args, **kwargs)

return cast(F, wrapper)
return cast("F", wrapper)

return _deprecate_kwarg

Expand Down Expand Up @@ -491,19 +491,21 @@ def __call__(self, func: T) -> T:
def indent(text: str | None, indents: int = 1) -> str:
if not text or not isinstance(text, str):
return ""
jointext = "".join(["\n"] + [" "] * indents)
return jointext.join(text.split("\n"))
indent_str = "\n" + " " * indents
if "\n" not in text:
return text
return indent_str.join(text.split("\n"))


__all__ = [
"Appender",
"Substitution",
"cache_readonly",
"deprecate",
"deprecate_kwarg",
"deprecate_nonkeyword_arguments",
"doc",
"future_version_msg",
"Substitution",
]


Expand Down