Skip to content

Commit

Permalink
More precise typing
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 committed Aug 14, 2024
1 parent d83c8ea commit 4e6587e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions manim/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ def deprecated(


def deprecated(
func: Callable | None = None,
func: Callable[P, T] | None = None,
since: str | None = None,
until: str | None = None,
replacement: str | None = None,
message: str = "",
) -> Callable:
) -> Callable[P, T] | Callable[[Callable[P, T]], Callable[P, T]]:
"""Decorator to mark a callable as deprecated.
The decorated callable will cause a warning when used. The docstring of the
Expand Down Expand Up @@ -185,7 +185,11 @@ def foo():
"""
# If used as factory:
if func is None:
return lambda func: deprecated(func, since, until, replacement, message)

def wrapper(f: Callable[P, T]) -> Callable[P, T]:
return deprecated(f, since, until, replacement, message)

return wrapper

what, name = _get_callable_info(func)

Expand Down

0 comments on commit 4e6587e

Please sign in to comment.