Skip to content
This repository was archived by the owner on Feb 3, 2026. It is now read-only.

Commit f0a36c2

Browse files
authored
Minimum working MLinearCollection (#9)
* finish implementing list interface * add tests and bugfixes * add docstrings * add naive hash * fix type, tests, and sort -> tuple * enforce positions of data Mobject * add test scene to linear collection * setup frame testing * Fix merge conflicts and version issues
1 parent edb8891 commit f0a36c2

File tree

5 files changed

+731
-184
lines changed

5 files changed

+731
-184
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ packages = [{include = "manim_data_structures", from = "src"}]
88
repository = "https://github.com/ufosc/manim-data-structures"
99
documentation = "https://docs.manim.community/en/stable/"
1010

11+
1112
[tool.poetry.dependencies]
1213
python = ">=3.9,<3.13"
1314
manim = ">=0.16.0"
1415

16+
1517
[tool.poetry.dev-dependencies]
1618
Sphinx = "^5.3.0"
1719
sphinx-autodoc-typehints = "^1.22"
@@ -45,6 +47,7 @@ use_parentheses = true
4547
ensure_newline_before_comments = true
4648
line_length = 88
4749

50+
4851
[tool.poetry.urls]
4952
"Bug Tracker" = "https://github.com/ufosc/manim-data-structures/issues"
5053
"Changelog" = "https://github.com/ufosc/manim-data-structures/blob/main/CHANGELOG.md"

src/manim_data_structures/m_array.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Contains classes to construct an array."""
2+
# Import * first so subsequent imports work
3+
from manim import *
24

3-
from copy import deepcopy
4-
5+
import typing
56
import numpy as np
6-
from manim import *
7+
from copy import deepcopy
78

89
from . import utils
910
from .m_enum import MArrayDirection, MArrayElementComp
@@ -1091,7 +1092,7 @@ def __init_props(
10911092
self.__mob_elem_value_props: dict = {}
10921093
self.__mob_elem_index_props: dict = {}
10931094
self.__scene: Scene = scene
1094-
self.__arr: typing.List[Any] = arr
1095+
self.__arr: typing.List[typing.Any] = arr
10951096
self.__label: str = label
10961097
self.__mob_arr: typing.List[MArrayElement] = []
10971098
self.__index_offset: int = index_offset
@@ -1506,7 +1507,7 @@ def animate_elem_index(self, index: int) -> "_AnimationBuilder": # type: ignore
15061507

15071508
def append_elem(
15081509
self,
1509-
value: Any,
1510+
value: typing.Any,
15101511
append_anim: Animation = Write,
15111512
append_anim_args: dict = {},
15121513
append_anim_target: MArrayElementComp = None,

src/manim_data_structures/m_variable.py

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

33
from manim import *
44

5+
import typing
56
from .m_array import MArrayElement
67

78

@@ -31,7 +32,7 @@ class MVariable(MArrayElement):
3132
3233
Attributes
3334
----------
34-
__value : Any
35+
__value : typing.Any
3536
The value of the variable.
3637
__index : :data:`~typing.Union`\0[:class:`str`, :class:`int`]
3738
The value of the index.
@@ -42,7 +43,7 @@ class MVariable(MArrayElement):
4243
def __init__(
4344
self,
4445
scene: Scene,
45-
value: Any = "",
46+
value: typing.Any = "",
4647
index: typing.Union[str, int] = "",
4748
label: str = "",
4849
mob_body_args: dict = {},
@@ -75,7 +76,7 @@ def __init__(
7576
Forwarded to constructor of the parent.
7677
"""
7778

78-
self.__value: Any = value
79+
self.__value: typing.Any = value
7980
self.__index: typing.Union[str, int] = index
8081
self.__label: str = label
8182

@@ -92,12 +93,12 @@ def __init__(
9293
**kwargs
9394
)
9495

95-
def fetch_value(self) -> Any:
96+
def fetch_value(self) -> typing.Any:
9697
"""Fetches the value of the variable.
9798
9899
Returns
99100
-------
100-
Any
101+
typing.Any
101102
:attr:`__value`.
102103
"""
103104

@@ -127,7 +128,7 @@ def fetch_label(self) -> str:
127128

128129
def update_value(
129130
self,
130-
value: Any,
131+
value: typing.Any,
131132
mob_value_args: dict = {},
132133
update_anim: Animation = Indicate,
133134
update_anim_args: dict = {},

0 commit comments

Comments
 (0)