Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added import lines to examples in `deprecation` docs (#2518)

Eshaan Naga Venkata5ec25905d71e
diff --git a/manim/utils/deprecation.py b/manim/utils/deprecation.py
index 06b024130..744aa8348 100644
--- a/manim/utils/deprecation.py
+++ b/manim/utils/deprecation.py
@@ -102,6 +102,8 @@ def deprecated(
--------
Basic usage::
+ from manim.utils.deprecation import deprecated
+
@deprecated
def foo(**kwargs):
pass
@@ -126,6 +128,8 @@ def deprecated(
You can specify additional information for a more precise warning::
+ from manim.utils.deprecation import deprecated
+
@deprecated(
since="v0.2",
until="v0.4",
@@ -140,6 +144,8 @@ def deprecated(
You may also use dates instead of versions::
+ from manim.utils.deprecation import deprecated
+
@deprecated(since="05/01/2021", until="06/01/2021")
def foo():
pass
@@ -277,6 +283,8 @@ def deprecated_params(
--------
Basic usage::
+ from manim.utils.deprecation import deprecated_params
+
@deprecated_params(params="a, b, c")
def foo(**kwargs):
pass
@@ -289,6 +297,8 @@ def deprecated_params(
You can also specify additional information for a more precise warning::
+ from manim.utils.deprecation import deprecated_params
+
@deprecated_params(
params="a, b, c",
since="v0.2",
@@ -303,6 +313,8 @@ def deprecated_params(
Basic parameter redirection::
+ from manim.utils.deprecation import deprecated_params
+
@deprecated_params(redirections=[
# Two ways to redirect one parameter to another:
("old_param", "new_param"),
@@ -317,6 +329,8 @@ def deprecated_params(
Redirecting using a calculated value::
+ from manim.utils.deprecation import deprecated_params
+
@deprecated_params(redirections=[
lambda runtime_in_ms: {"run_time": runtime_in_ms / 1000}
])
@@ -329,6 +343,8 @@ def deprecated_params(
Redirecting multiple parameter values to one::
+ from manim.utils.deprecation import deprecated_params
+
@deprecated_params(redirections=[
lambda buff_x=1, buff_y=1: {"buff": (buff_x, buff_y)}
])
@@ -341,6 +357,8 @@ def deprecated_params(
Redirect one parameter to multiple::
+ from manim.utils.deprecation import deprecated_params
+
@deprecated_params(redirections=[
lambda buff=1: {"buff_x": buff[0], "buff_y": buff[1]} if isinstance(buff, tuple)
else {"buff_x": buff, "buff_y": buff}