Skip to content

Commit 05cc414

Browse files
Refactor imports from collections.abc, typing and typing_extensions for Python 3.9 (#4353)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b3df1cf commit 05cc414

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+112
-142
lines changed

.github/scripts/ci_build_cairo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import sys
1515
import tarfile
1616
import tempfile
17-
import typing
1817
import urllib.request
18+
from collections.abc import Generator
1919
from contextlib import contextmanager
2020
from pathlib import Path
2121
from sys import stdout
@@ -67,7 +67,7 @@ def run_command(command, cwd=None, env=None):
6767

6868

6969
@contextmanager
70-
def gha_group(title: str) -> typing.Generator:
70+
def gha_group(title: str) -> Generator:
7171
if not is_ci():
7272
yield
7373
return

manim/animation/animation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
__all__ = ["Animation", "Wait", "Add", "override_animation"]
1515

1616

17-
from collections.abc import Iterable, Sequence
17+
from collections.abc import Callable, Iterable, Sequence
1818
from copy import deepcopy
1919
from functools import partialmethod
20-
from typing import TYPE_CHECKING, Any, Callable
20+
from typing import TYPE_CHECKING, Any
2121

2222
from typing_extensions import Self
2323

manim/animation/changing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
__all__ = ["AnimatedBoundary", "TracedPath"]
66

7-
from collections.abc import Sequence
8-
from typing import Callable
7+
from collections.abc import Callable, Sequence
8+
from typing import Any
99

10-
from typing_extensions import Any, Self
10+
from typing_extensions import Self
1111

1212
from manim.mobject.mobject import Mobject
1313
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL

manim/animation/composition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import annotations
44

5-
from collections.abc import Iterable, Sequence
6-
from typing import TYPE_CHECKING, Any, Callable
5+
from collections.abc import Callable, Iterable, Sequence
6+
from typing import TYPE_CHECKING, Any
77

88
import numpy as np
99

manim/animation/creation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def construct(self):
7676

7777

7878
import itertools as it
79-
from collections.abc import Iterable, Sequence
80-
from typing import TYPE_CHECKING, Callable
79+
from collections.abc import Callable, Iterable, Sequence
80+
from typing import TYPE_CHECKING
8181

8282
import numpy as np
8383

manim/animation/fading.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ def construct(self):
1919
"FadeIn",
2020
]
2121

22+
from typing import Any
23+
2224
import numpy as np
23-
from typing_extensions import Any
2425

2526
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
2627

manim/animation/growing.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ def construct(self):
3131
"SpinInFromNothing",
3232
]
3333

34-
import typing
34+
from typing import TYPE_CHECKING, Any
3535

3636
from ..animation.transform import Transform
3737
from ..constants import PI
3838
from ..utils.paths import spiral_path
3939

40-
if typing.TYPE_CHECKING:
41-
from typing import Any
42-
40+
if TYPE_CHECKING:
4341
from manim.mobject.geometry.line import Arrow
4442
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
4543
from manim.typing import Point3DLike, Vector3DLike

manim/animation/numbers.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
__all__ = ["ChangingDecimal", "ChangeDecimalToValue"]
66

77

8-
import typing
9-
10-
from typing_extensions import Any
8+
from collections.abc import Callable
9+
from typing import Any
1110

1211
from manim.mobject.text.numbers import DecimalNumber
1312

@@ -54,7 +53,7 @@ def construct(self):
5453
def __init__(
5554
self,
5655
decimal_mob: DecimalNumber,
57-
number_update_func: typing.Callable[[float], float],
56+
number_update_func: Callable[[float], float],
5857
suspend_mobject_updating: bool = False,
5958
**kwargs: Any,
6059
) -> None:

manim/animation/rotation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
__all__ = ["Rotating", "Rotate"]
66

7-
from collections.abc import Sequence
8-
from typing import TYPE_CHECKING, Callable
7+
from collections.abc import Callable, Sequence
8+
from typing import TYPE_CHECKING, Any
99

1010
import numpy as np
11-
from typing_extensions import Any
1211

1312
from ..animation.animation import Animation
1413
from ..animation.transform import Transform

manim/animation/speedmodifier.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
import inspect
66
import types
7-
from typing import TYPE_CHECKING, Callable
7+
from collections.abc import Callable
8+
from typing import TYPE_CHECKING
89

910
from numpy import piecewise
1011

0 commit comments

Comments
 (0)