mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Move Selector and Span to manimlib.typing
This commit is contained in:
parent
6beea2a7eb
commit
dd662b0d12
4 changed files with 16 additions and 44 deletions
|
@ -10,23 +10,8 @@ from manimlib.utils.tex_file_writing import tex_content_to_svg_file
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import re
|
|
||||||
from typing import Iterable, Union
|
|
||||||
|
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.typing import ManimColor
|
from manimlib.typing import ManimColor, Span, Selector
|
||||||
|
|
||||||
Span = tuple[int, int]
|
|
||||||
Selector = Union[
|
|
||||||
str,
|
|
||||||
re.Pattern,
|
|
||||||
tuple[Union[int, None], Union[int, None]],
|
|
||||||
Iterable[Union[
|
|
||||||
str,
|
|
||||||
re.Pattern,
|
|
||||||
tuple[Union[int, None], Union[int, None]]
|
|
||||||
]]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
SCALE_FACTOR_PER_FONT_POINT = 0.001
|
SCALE_FACTOR_PER_FONT_POINT = 0.001
|
||||||
|
|
|
@ -17,20 +17,8 @@ from manimlib.utils.color import int_to_hex
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Callable, Iterable, Union
|
from typing import Callable
|
||||||
from manimlib.typing import ManimColor
|
from manimlib.typing import ManimColor, Span, Selector
|
||||||
|
|
||||||
Span = tuple[int, int]
|
|
||||||
Selector = Union[
|
|
||||||
str,
|
|
||||||
re.Pattern,
|
|
||||||
tuple[Union[int, None], Union[int, None]],
|
|
||||||
Iterable[Union[
|
|
||||||
str,
|
|
||||||
re.Pattern,
|
|
||||||
tuple[Union[int, None], Union[int, None]]
|
|
||||||
]]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class StringMobject(SVGMobject, ABC):
|
class StringMobject(SVGMobject, ABC):
|
||||||
|
|
|
@ -24,21 +24,10 @@ from manimlib.utils.simple_functions import hash_string
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Iterable, Union
|
from typing import Iterable
|
||||||
|
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.typing import ManimColor
|
from manimlib.typing import ManimColor, Span, Selector
|
||||||
Span = tuple[int, int]
|
|
||||||
Selector = Union[
|
|
||||||
str,
|
|
||||||
re.Pattern,
|
|
||||||
tuple[Union[int, None], Union[int, None]],
|
|
||||||
Iterable[Union[
|
|
||||||
str,
|
|
||||||
re.Pattern,
|
|
||||||
tuple[Union[int, None], Union[int, None]]
|
|
||||||
]]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
TEXT_MOB_SCALE_FACTOR = 0.0076
|
TEXT_MOB_SCALE_FACTOR = 0.0076
|
||||||
|
|
|
@ -1,14 +1,24 @@
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Union, Tuple, Annotated, Literal
|
from typing import Union, Tuple, Annotated, Literal, Iterable
|
||||||
from colour import Color
|
from colour import Color
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import re
|
||||||
|
|
||||||
# Abbreviations for a common types
|
# Abbreviations for a common types
|
||||||
ManimColor = Union[str, Color, None]
|
ManimColor = Union[str, Color, None]
|
||||||
RangeSpecifier = Tuple[float, float, float] | Tuple[float, float]
|
RangeSpecifier = Tuple[float, float, float] | Tuple[float, float]
|
||||||
|
|
||||||
|
|
||||||
|
Span = tuple[int, int]
|
||||||
|
SingleSelector = Union[
|
||||||
|
str,
|
||||||
|
re.Pattern,
|
||||||
|
tuple[Union[int, None], Union[int, None]],
|
||||||
|
]
|
||||||
|
Selector = Union[SingleSelector, Iterable[SingleSelector]]
|
||||||
|
|
||||||
# These are various alternate names for np.ndarray meant to specify
|
# These are various alternate names for np.ndarray meant to specify
|
||||||
# certain shapes.
|
# certain shapes.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue