diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2fb0348f59..e7b73aaa74 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,12 +12,6 @@ repos: - id: end-of-file-fixer - id: check-toml name: Validate Poetry - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 - hooks: - - id: pyupgrade - name: Update code to new python versions - args: [--py39-plus] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: diff --git a/manim/mobject/geometry/boolean_ops.py b/manim/mobject/geometry/boolean_ops.py index c17cf86cbb..ef5bd4fa58 100644 --- a/manim/mobject/geometry/boolean_ops.py +++ b/manim/mobject/geometry/boolean_ops.py @@ -142,7 +142,7 @@ def _convert_skia_path_to_vmobject(self, path: SkiaPath) -> VMobject: n1, n2 = self._convert_2d_to_3d_array(points) vmobject.add_quadratic_bezier_curve_to(n1, n2) else: - raise Exception("Unsupported: %s" % path_verb) + raise Exception(f"Unsupported: {path_verb}") return vmobject diff --git a/manim/mobject/graphing/scale.py b/manim/mobject/graphing/scale.py index 5a3a30410b..8ba8a7e63c 100644 --- a/manim/mobject/graphing/scale.py +++ b/manim/mobject/graphing/scale.py @@ -182,7 +182,7 @@ def get_custom_labels( tex_labels = [ Integer( self.base, - unit="^{%s}" % (f"{self.inverse_function(i):.{unit_decimal_places}f}"), + unit="^{%s}" % (f"{self.inverse_function(i):.{unit_decimal_places}f}"), # noqa: UP031 **base_config, ) for i in val_range diff --git a/manim/mobject/opengl/opengl_mobject.py b/manim/mobject/opengl/opengl_mobject.py index ac34e73509..932b1d0d10 100644 --- a/manim/mobject/opengl/opengl_mobject.py +++ b/manim/mobject/opengl/opengl_mobject.py @@ -2659,12 +2659,7 @@ def set_color_by_xyz_func( glsl_snippet = glsl_snippet.replace(char, "point." + char) rgb_list = get_colormap_list(colormap) self.set_color_by_code( - "color.rgb = float_to_color({}, {}, {}, {});".format( - glsl_snippet, - float(min_value), - float(max_value), - get_colormap_code(rgb_list), - ), + f"color.rgb = float_to_color({glsl_snippet}, {float(min_value)}, {float(max_value)}, {get_colormap_code(rgb_list)});", ) return self diff --git a/manim/mobject/text/tex_mobject.py b/manim/mobject/text/tex_mobject.py index 449b21d385..c6810d8f65 100644 --- a/manim/mobject/text/tex_mobject.py +++ b/manim/mobject/text/tex_mobject.py @@ -175,8 +175,8 @@ def _modify_special_strings(self, tex): tex = self._remove_stray_braces(tex) for context in ["array"]: - begin_in = ("\\begin{%s}" % context) in tex - end_in = ("\\end{%s}" % context) in tex + begin_in = ("\\begin{%s}" % context) in tex # noqa: UP031 + end_in = ("\\end{%s}" % context) in tex # noqa: UP031 if begin_in ^ end_in: # Just turn this into a blank string, # which means caller should leave a diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py index 328a8acce8..e99ba4d8e8 100644 --- a/manim/mobject/types/vectorized_mobject.py +++ b/manim/mobject/types/vectorized_mobject.py @@ -2308,7 +2308,7 @@ def remove(self, key: Hashable) -> Self: my_dict.remove("square") """ if key not in self.submob_dict: - raise KeyError("The given key '%s' is not present in the VDict" % str(key)) + raise KeyError(f"The given key '{key!s}' is not present in the VDict") super().remove(self.submob_dict[key]) del self.submob_dict[key] return self diff --git a/manim/scene/vector_space_scene.py b/manim/scene/vector_space_scene.py index e9304115ef..d4b632cca8 100644 --- a/manim/scene/vector_space_scene.py +++ b/manim/scene/vector_space_scene.py @@ -297,7 +297,7 @@ def get_vector_label( """ if not isinstance(label, MathTex): if len(label) == 1: - label = "\\vec{\\textbf{%s}}" % label + label = "\\vec{\\textbf{%s}}" % label # noqa: UP031 label = MathTex(label) if color is None: color = vector.get_color() @@ -904,9 +904,8 @@ def add_transformable_label( if new_label: label_mob.target_text = new_label else: - label_mob.target_text = "{}({})".format( - transformation_name, - label_mob.get_tex_string(), + label_mob.target_text = ( + f"{transformation_name}({label_mob.get_tex_string()})" ) label_mob.vector = vector label_mob.kwargs = kwargs diff --git a/manim/utils/docbuild/autocolor_directive.py b/manim/utils/docbuild/autocolor_directive.py index 37c63efb29..574aaedf77 100644 --- a/manim/utils/docbuild/autocolor_directive.py +++ b/manim/utils/docbuild/autocolor_directive.py @@ -38,7 +38,7 @@ def run(self) -> list[nodes.Element]: return [ nodes.error( None, - nodes.paragraph(text="Failed to import module '%s'" % module_name), + nodes.paragraph(text=f"Failed to import module '{module_name}'"), ) ] diff --git a/manim/utils/docbuild/manim_directive.py b/manim/utils/docbuild/manim_directive.py index 8b65293956..cd277970e3 100644 --- a/manim/utils/docbuild/manim_directive.py +++ b/manim/utils/docbuild/manim_directive.py @@ -355,7 +355,7 @@ def _write_rendering_stats(scene_name: str, run_time: str, file_name: str) -> No [ re.sub(r"^(reference\/)|(manim\.)", "", file_name), scene_name, - "%.3f" % run_time, + f"{run_time:.3f}", ], ) diff --git a/pyproject.toml b/pyproject.toml index ebf7a27b5d..c38f80daef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,6 +139,7 @@ select = [ "E", "F", "I", + "UP", ] ignore = [