Skip to content

[pre-commit.ci] pre-commit autoupdate #4204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-toml
name: Validate pyproject.toml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.0
rev: v0.12.7
hooks:
- id: ruff
name: ruff lint
Expand All @@ -22,7 +22,7 @@ repos:
- id: ruff-format
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
rev: v1.17.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/graphing/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
**kwargs: Any,
):
def internal_parametric_function(t: float) -> Point3D:
"""Wrap ``function``'s output inside a NumPy array."""

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class Warning

Assignment overwrites attribute function, which was previously defined in subclass
FunctionGraph
.
return np.asarray(function(t))

self.function = internal_parametric_function
Expand Down Expand Up @@ -228,7 +228,7 @@
self.parametric_function: Callable[[float], Point3D] = lambda t: np.array(
[t, function(t), 0]
)
self.function: Callable[[float], Any] = function
self.function = function # type: ignore[assignment]
super().__init__(self.parametric_function, self.x_range, color=color, **kwargs)

def get_function(self) -> Callable[[float], Any]:
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/graphing/probability.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def get_subdivision_braces_and_labels(
"direction": direction,
"buff": buff,
}
return VGroup(parts.braces, parts.labels)
return VGroup(parts.braces, parts.labels) # type: ignore[arg-type]

def get_side_braces_and_labels(
self,
Expand Down
5 changes: 1 addition & 4 deletions manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3288,10 +3288,7 @@ def build(self) -> Animation:
_MethodAnimation,
)

if self.overridden_animation:
anim = self.overridden_animation
else:
anim = _MethodAnimation(self.mobject, self.methods)
anim = self.overridden_animation or _MethodAnimation(self.mobject, self.methods)

for attr, value in self.anim_args.items():
setattr(anim, attr, value)
Expand Down
5 changes: 1 addition & 4 deletions manim/mobject/opengl/opengl_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2993,10 +2993,7 @@ def update_target(*method_args, **method_kwargs):
def build(self) -> _MethodAnimation:
from manim.animation.transform import _MethodAnimation

if self.overridden_animation:
anim = self.overridden_animation
else:
anim = _MethodAnimation(self.mobject, self.methods)
anim = self.overridden_animation or _MethodAnimation(self.mobject, self.methods)

for attr, value in self.anim_args.items():
setattr(anim, attr, value)
Expand Down
6 changes: 3 additions & 3 deletions manim/mobject/svg/svg_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def generate_mobject(self) -> None:
"""Parse the SVG and translate its elements to submobjects."""
file_path = self.get_file_path()
element_tree = ET.parse(file_path)
new_tree = self.modify_xml_tree(element_tree)
new_tree = self.modify_xml_tree(element_tree) # type: ignore[arg-type]
# Create a temporary svg file to dump modified svg to be parsed
modified_file_path = file_path.with_name(f"{file_path.stem}_{file_path.suffix}")
new_tree.write(modified_file_path)
Expand Down Expand Up @@ -232,12 +232,12 @@ def modify_xml_tree(self, element_tree: ET.ElementTree) -> ET.ElementTree:
"style",
)
root = element_tree.getroot()
root_style_dict = {k: v for k, v in root.attrib.items() if k in style_keys}
root_style_dict = {k: v for k, v in root.attrib.items() if k in style_keys} # type: ignore[union-attr]

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

def generate_config_style_dict(self) -> dict[str, str]:
Expand Down
2 changes: 1 addition & 1 deletion manim/scene/vector_space_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ def add_transformable_label(
)
label_mob.vector = vector # type: ignore[attr-defined]
label_mob.kwargs = kwargs # type: ignore[attr-defined]
if "animate" in label_mob.kwargs: # type: ignore[attr-defined]
if "animate" in label_mob.kwargs: # type: ignore[operator]
label_mob.kwargs.pop("animate") # type: ignore[attr-defined]
self.transformable_labels.append(label_mob)
return cast(MathTex, label_mob)
Expand Down
2 changes: 1 addition & 1 deletion manim/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def deprecate(func: Callable[..., T], *args: Any, **kwargs: Any) -> T:
# The following line raises this mypy error:
# Accessing "__init__" on an instance is unsound, since instance.__init__
# could be from an incompatible subclass [misc]</pre>
func.__init__ = decorate(func.__init__, deprecate) # type: ignore[misc]
func.__init__ = decorate(func.__init__, deprecate) # type: ignore[method-assign]
return func

func = decorate(func, deprecate)
Expand Down
4 changes: 2 additions & 2 deletions manim/utils/docbuild/manim_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ def run(self) -> list[nodes.Element]:
]
source_block = "\n".join(source_block_in)

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

Expand Down
4 changes: 2 additions & 2 deletions manim/utils/docbuild/module_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ def parse_module_attributes() -> tuple[AliasDocsDict, DataDict, TypeVarDict]:
# TODO: ast.TypeAlias does not exist before Python 3.12, and that
# could be the reason why MyPy does not recognize these as
# attributes of node.
alias_name = node.name.id if is_type_alias else node.target.id # type: ignore[attr-defined]
definition_node = node.value # type: ignore[attr-defined]
alias_name = node.name.id if is_type_alias else node.target.id
definition_node = node.value

# If the definition is a Union, replace with vertical bar notation.
# Instead of "Union[Type1, Type2]", we'll have "Type1 | Type2".
Expand Down
2 changes: 1 addition & 1 deletion manim/utils/ipython_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def construct(self):
args = main(modified_args, standalone_mode=False, prog_name="manim")
assert isinstance(local_ns, dict)
with tempconfig(local_ns.get("config", {})):
config.digest_args(args) # type: ignore[arg-type]
config.digest_args(args)

renderer = None
if config.renderer == RendererType.OPENGL:
Expand Down
Loading