Skip to content

Commit 91152cc

Browse files
author
NIK-TIGER-BILL
committed
fix: address review — remove **_kwargs, set docstring on wrapper, drop deprecation from dev deps
- Remove **_kwargs parameter from docstring_deprecated() since all call sites use only 'details' and 'deprecated_in' keyword args - Move docstring modification to wrapper instead of original func to preserve the original function's __doc__ - Remove deprecation==2.1.0 from requirements-devel.txt to fully eliminate the unmaintained dependency Signed-off-by: NIK-TIGER-BILL <nik.tiger.bill@github.com>
1 parent b3c1fe8 commit 91152cc

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

requirements-devel.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ grpcio==1.75.1
55
grpcio-tools==1.75.1
66
grpcio-health-checking==1.75.1
77
pydantic==2.12.0
8-
deprecation==2.1.0
98

109
build
1110
twine

weaviate/util.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
BYTES_PER_CHUNK = 65535 # The number of bytes to read per chunk when encoding files ~ 64kb
3535

3636

37-
def docstring_deprecated(details: str = "", deprecated_in: str = "", **_kwargs: object) -> Callable:
37+
def docstring_deprecated(details: str = "", deprecated_in: str = "") -> Callable:
3838
"""Stdlib replacement for ``deprecation.deprecated``.
3939
4040
The ``deprecation`` package has not been maintained since 2019 and is
@@ -46,10 +46,6 @@ def docstring_deprecated(details: str = "", deprecated_in: str = "", **_kwargs:
4646
"""
4747

4848
def decorator(func: Callable) -> Callable:
49-
docstring = func.__doc__ or ""
50-
note = f".. deprecated:: {deprecated_in}\n {details}\n\n" if deprecated_in else ""
51-
func.__doc__ = note + docstring
52-
5349
@functools.wraps(func)
5450
def wrapper(*args: object, **kwargs: object) -> object:
5551
_warnings.warn(
@@ -59,6 +55,10 @@ def wrapper(*args: object, **kwargs: object) -> object:
5955
)
6056
return func(*args, **kwargs)
6157

58+
docstring = func.__doc__ or ""
59+
note = f".. deprecated:: {deprecated_in}\n {details}\n\n" if deprecated_in else ""
60+
wrapper.__doc__ = note + docstring
61+
6262
return wrapper # type: ignore[return-value]
6363

6464
return decorator

0 commit comments

Comments
 (0)