core[patch]: deprecation docstring with lib (#18350)

This commit is contained in:
Erick Friis 2024-02-29 16:44:13 -08:00 committed by GitHub
parent bce0684327
commit 11cb42c2c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -257,10 +257,12 @@ def deprecated(
addendum, addendum,
] ]
details = " ".join([component.strip() for component in components if component]) details = " ".join([component.strip() for component in components if component])
package = _name.split(".")[0].replace("_", "-") if "." in _name else None
since_str = f"{package}=={since}" if package else since
new_doc = ( new_doc = (
f"[*Deprecated*] {old_doc}\n" f"[*Deprecated*] {old_doc}\n"
f"{notes_header if notes_header not in old_doc else ''}\n" f"{notes_header if notes_header not in old_doc else ''}\n"
f".. deprecated:: {since}\n" f".. deprecated:: {since_str}\n"
f" {details}" f" {details}"
) )