Skip to content

Commit 2d8d81c

Browse files
[pre-commit.ci] pre-commit autoupdate (#4204)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.12.7](astral-sh/ruff-pre-commit@v0.11.0...v0.12.7) - [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.1](pre-commit/mirrors-mypy@v1.15.0...v1.17.1) * Fix errors --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: JasonGrace2282 <[email protected]>
1 parent fc68c10 commit 2d8d81c

File tree

11 files changed

+16
-22
lines changed

11 files changed

+16
-22
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: check-toml
1414
name: Validate pyproject.toml
1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.11.0
16+
rev: v0.12.7
1717
hooks:
1818
- id: ruff
1919
name: ruff lint
@@ -22,7 +22,7 @@ repos:
2222
- id: ruff-format
2323
types: [python]
2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.15.0
25+
rev: v1.17.1
2626
hooks:
2727
- id: mypy
2828
additional_dependencies:

manim/mobject/graphing/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def __init__(
228228
self.parametric_function: Callable[[float], Point3D] = lambda t: np.array(
229229
[t, function(t), 0]
230230
)
231-
self.function: Callable[[float], Any] = function
231+
self.function = function # type: ignore[assignment]
232232
super().__init__(self.parametric_function, self.x_range, color=color, **kwargs)
233233

234234
def get_function(self) -> Callable[[float], Any]:

manim/mobject/graphing/probability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def get_subdivision_braces_and_labels(
172172
"direction": direction,
173173
"buff": buff,
174174
}
175-
return VGroup(parts.braces, parts.labels)
175+
return VGroup(parts.braces, parts.labels) # type: ignore[arg-type]
176176

177177
def get_side_braces_and_labels(
178178
self,

manim/mobject/mobject.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,10 +3288,7 @@ def build(self) -> Animation:
32883288
_MethodAnimation,
32893289
)
32903290

3291-
if self.overridden_animation:
3292-
anim = self.overridden_animation
3293-
else:
3294-
anim = _MethodAnimation(self.mobject, self.methods)
3291+
anim = self.overridden_animation or _MethodAnimation(self.mobject, self.methods)
32953292

32963293
for attr, value in self.anim_args.items():
32973294
setattr(anim, attr, value)

manim/mobject/opengl/opengl_mobject.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,10 +2993,7 @@ def update_target(*method_args, **method_kwargs):
29932993
def build(self) -> _MethodAnimation:
29942994
from manim.animation.transform import _MethodAnimation
29952995

2996-
if self.overridden_animation:
2997-
anim = self.overridden_animation
2998-
else:
2999-
anim = _MethodAnimation(self.mobject, self.methods)
2996+
anim = self.overridden_animation or _MethodAnimation(self.mobject, self.methods)
30002997

30012998
for attr, value in self.anim_args.items():
30022999
setattr(anim, attr, value)

manim/mobject/svg/svg_mobject.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def generate_mobject(self) -> None:
195195
"""Parse the SVG and translate its elements to submobjects."""
196196
file_path = self.get_file_path()
197197
element_tree = ET.parse(file_path)
198-
new_tree = self.modify_xml_tree(element_tree)
198+
new_tree = self.modify_xml_tree(element_tree) # type: ignore[arg-type]
199199
# Create a temporary svg file to dump modified svg to be parsed
200200
modified_file_path = file_path.with_name(f"{file_path.stem}_{file_path.suffix}")
201201
new_tree.write(modified_file_path)
@@ -232,12 +232,12 @@ def modify_xml_tree(self, element_tree: ET.ElementTree) -> ET.ElementTree:
232232
"style",
233233
)
234234
root = element_tree.getroot()
235-
root_style_dict = {k: v for k, v in root.attrib.items() if k in style_keys}
235+
root_style_dict = {k: v for k, v in root.attrib.items() if k in style_keys} # type: ignore[union-attr]
236236

237237
new_root = ET.Element("svg", {})
238238
config_style_node = ET.SubElement(new_root, "g", config_style_dict)
239239
root_style_node = ET.SubElement(config_style_node, "g", root_style_dict)
240-
root_style_node.extend(root)
240+
root_style_node.extend(root) # type: ignore[arg-type]
241241
return ET.ElementTree(new_root)
242242

243243
def generate_config_style_dict(self) -> dict[str, str]:

manim/scene/vector_space_scene.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ def add_transformable_label(
973973
)
974974
label_mob.vector = vector # type: ignore[attr-defined]
975975
label_mob.kwargs = kwargs # type: ignore[attr-defined]
976-
if "animate" in label_mob.kwargs: # type: ignore[attr-defined]
976+
if "animate" in label_mob.kwargs: # type: ignore[operator]
977977
label_mob.kwargs.pop("animate") # type: ignore[attr-defined]
978978
self.transformable_labels.append(label_mob)
979979
return cast(MathTex, label_mob)

manim/utils/deprecation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def deprecate(func: Callable[..., T], *args: Any, **kwargs: Any) -> T:
253253
# The following line raises this mypy error:
254254
# Accessing "__init__" on an instance is unsound, since instance.__init__
255255
# could be from an incompatible subclass [misc]</pre>
256-
func.__init__ = decorate(func.__init__, deprecate) # type: ignore[misc]
256+
func.__init__ = decorate(func.__init__, deprecate) # type: ignore[method-assign]
257257
return func
258258

259259
func = decorate(func, deprecate)

manim/utils/docbuild/manim_directive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ def run(self) -> list[nodes.Element]:
268268
]
269269
source_block = "\n".join(source_block_in)
270270

271-
config.media_dir = (Path(setup.confdir) / "media").absolute() # type: ignore[attr-defined,assignment]
271+
config.media_dir = (Path(setup.confdir) / "media").absolute() # type: ignore[attr-defined]
272272
config.images_dir = "{media_dir}/images"
273273
config.video_dir = "{media_dir}/videos/{quality}"
274274
output_file = f"{clsname}-{classnamedict[clsname]}"
275-
config.assets_dir = Path("_static") # type: ignore[assignment]
275+
config.assets_dir = Path("_static")
276276
config.progress_bar = "none"
277277
config.verbosity = "WARNING"
278278

manim/utils/docbuild/module_parsing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def parse_module_attributes() -> tuple[AliasDocsDict, DataDict, TypeVarDict]:
177177
# TODO: ast.TypeAlias does not exist before Python 3.12, and that
178178
# could be the reason why MyPy does not recognize these as
179179
# attributes of node.
180-
alias_name = node.name.id if is_type_alias else node.target.id # type: ignore[attr-defined]
181-
definition_node = node.value # type: ignore[attr-defined]
180+
alias_name = node.name.id if is_type_alias else node.target.id
181+
definition_node = node.value
182182

183183
# If the definition is a Union, replace with vertical bar notation.
184184
# Instead of "Union[Type1, Type2]", we'll have "Type1 | Type2".

0 commit comments

Comments
 (0)