mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
[pre-commit.ci] pre-commit autoupdate (#2900)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/pyupgrade: v2.37.1 → v3.2.0](https://github.com/asottile/pyupgrade/compare/v2.37.1...v3.2.0) - [github.com/psf/black: 22.6.0 → 22.10.0](https://github.com/psf/black/compare/22.6.0...22.10.0) - [github.com/asottile/yesqa: v1.3.0 → v1.4.0](https://github.com/asottile/yesqa/compare/v1.3.0...v1.4.0) - [github.com/PyCQA/flake8: 4.0.1 → 5.0.4](https://github.com/PyCQA/flake8/compare/4.0.1...5.0.4) - [github.com/pre-commit/mirrors-mypy: v0.961 → v0.982](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.982) - [github.com/codespell-project/codespell: v2.1.0 → v2.2.2](https://github.com/codespell-project/codespell/compare/v2.1.0...v2.2.2) * fixed B902 * ignore B903, B950 * fixed B902 for OpenGLMobject.affects_shader_info_id * ignore B902 in opengl_compatibility * fixed B902 in OpenGLVMobject.triggers_refreshed_triangulation * fixed codespell errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * move decorators outside of classes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added Nam to ignored words * ignore B902 in opengl_compatibility (again) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks" This reverts commit119e7ddb88. * move yesqa after flake8 call * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove yesqa from pre-commit stack * Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks" This reverts commita5b4f70f21. * codespell: ignore "nam" Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
This commit is contained in:
parent
5ca1763068
commit
d76fa670ca
7 changed files with 43 additions and 46 deletions
|
|
@ -1,4 +1,4 @@
|
|||
[codespell]
|
||||
exclude-file=.codespell_ignorelines
|
||||
check-hidden=True
|
||||
ignore-words-list = sherif
|
||||
ignore-words-list = nam,sherif,falsy
|
||||
|
|
|
|||
2
.flake8
2
.flake8
|
|
@ -21,7 +21,7 @@ extend-ignore = E203, W503, D202, D212, D213, D404
|
|||
A001, A002, A003,
|
||||
|
||||
# Plug-in: flake8-bugbear
|
||||
B006, B007, B008, B009, B010,
|
||||
B006, B007, B008, B009, B010, B903, B950,
|
||||
|
||||
# Plug-in: flake8-simplify
|
||||
SIM105, SIM106, SIM119,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ repos:
|
|||
name: isort (pyi)
|
||||
types: [pyi]
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.37.1
|
||||
rev: v3.2.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
name: Update code to new python versions
|
||||
|
|
@ -35,7 +35,7 @@ repos:
|
|||
- id: python-check-blanket-noqa
|
||||
name: Precision flake ignores
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.6.0
|
||||
rev: 22.10.0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/asottile/blacken-docs
|
||||
|
|
@ -43,26 +43,21 @@ repos:
|
|||
hooks:
|
||||
- id: blacken-docs
|
||||
additional_dependencies: [black==22.3.0]
|
||||
- repo: https://github.com/asottile/yesqa
|
||||
rev: v1.3.0
|
||||
hooks:
|
||||
- id: yesqa
|
||||
name: Remove unneeded flake ignores
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 4.0.1
|
||||
rev: 5.0.4
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies: [flake8-builtins==1.5.3, flake8-bugbear==21.4.3,
|
||||
flake8-docstrings==1.6.0, flake8-rst-docstrings==0.2.3,
|
||||
flake8-pytest-style==1.5.0, flake8-simplify==0.14.1, flake8-comprehensions>=3.6.1]
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: 'v0.961'
|
||||
rev: 'v0.982'
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies: [types-decorator, types-docutils, types-requests, types-setuptools]
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.1.0
|
||||
rev: v2.2.2
|
||||
hooks:
|
||||
- id: codespell
|
||||
args: ["-L", "medias"]
|
||||
args: ["-L", "medias,nam"]
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class ChangeSpeed(Animation):
|
|||
|
||||
@classmethod
|
||||
def add_updater(
|
||||
self,
|
||||
cls,
|
||||
mobject: Mobject,
|
||||
update_function: Updater,
|
||||
index: int | None = None,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ConvertToOpenGL(ABCMeta):
|
|||
|
||||
_converted_classes = []
|
||||
|
||||
def __new__(mcls, name, bases, namespace):
|
||||
def __new__(mcls, name, bases, namespace): # noqa: B902
|
||||
if config.renderer == "opengl":
|
||||
# Must check class names to prevent
|
||||
# cyclic importing.
|
||||
|
|
@ -40,6 +40,6 @@ class ConvertToOpenGL(ABCMeta):
|
|||
|
||||
return super().__new__(mcls, name, bases, namespace)
|
||||
|
||||
def __init__(cls, name, bases, namespace):
|
||||
def __init__(cls, name, bases, namespace): # noqa: B902
|
||||
super().__init__(name, bases, namespace)
|
||||
cls._converted_classes.append(cls)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,17 @@ from manim.utils.space_ops import (
|
|||
)
|
||||
|
||||
|
||||
def affects_shader_info_id(func):
|
||||
@wraps(func)
|
||||
def wrapper(self):
|
||||
for mob in self.get_family():
|
||||
func(mob)
|
||||
mob.refresh_shader_wrapper_id()
|
||||
return self
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
class OpenGLMobject:
|
||||
"""Mathematical Object: base class for objects that can be displayed on screen.
|
||||
|
||||
|
|
@ -2531,16 +2542,6 @@ class OpenGLMobject:
|
|||
|
||||
# Operations touching shader uniforms
|
||||
|
||||
def affects_shader_info_id(func):
|
||||
@wraps(func)
|
||||
def wrapper(self):
|
||||
for mob in self.get_family():
|
||||
func(mob)
|
||||
# mob.refresh_shader_wrapper_id()
|
||||
return self
|
||||
|
||||
return wrapper
|
||||
|
||||
@affects_shader_info_id
|
||||
def fix_in_frame(self):
|
||||
self.is_fixed_in_frame = 1.0
|
||||
|
|
@ -2623,9 +2624,9 @@ class OpenGLMobject:
|
|||
|
||||
# For shader data
|
||||
|
||||
# def refresh_shader_wrapper_id(self):
|
||||
# self.shader_wrapper.refresh_id()
|
||||
# return self
|
||||
def refresh_shader_wrapper_id(self):
|
||||
self.shader_wrapper.refresh_id()
|
||||
return self
|
||||
|
||||
def get_shader_wrapper(self):
|
||||
from manim.renderer.shader_wrapper import ShaderWrapper
|
||||
|
|
|
|||
|
|
@ -43,6 +43,24 @@ JOINT_TYPE_MAP = {
|
|||
}
|
||||
|
||||
|
||||
def triggers_refreshed_triangulation(func):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
old_points = np.empty((0, 3))
|
||||
for mob in self.family_members_with_points():
|
||||
old_points = np.concatenate((old_points, mob.points), axis=0)
|
||||
func(self, *args, **kwargs)
|
||||
new_points = np.empty((0, 3))
|
||||
for mob in self.family_members_with_points():
|
||||
new_points = np.concatenate((new_points, mob.points), axis=0)
|
||||
if not np.array_equal(new_points, old_points):
|
||||
self.refresh_triangulation()
|
||||
self.refresh_unit_normal()
|
||||
return self
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
class OpenGLVMobject(OpenGLMobject):
|
||||
"""A vectorized mobject."""
|
||||
|
||||
|
|
@ -1449,23 +1467,6 @@ class OpenGLVMobject(OpenGLMobject):
|
|||
self.needs_new_triangulation = False
|
||||
return tri_indices
|
||||
|
||||
def triggers_refreshed_triangulation(func):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
old_points = np.empty((0, 3))
|
||||
for mob in self.family_members_with_points():
|
||||
old_points = np.concatenate((old_points, mob.points), axis=0)
|
||||
func(self, *args, **kwargs)
|
||||
new_points = np.empty((0, 3))
|
||||
for mob in self.family_members_with_points():
|
||||
new_points = np.concatenate((new_points, mob.points), axis=0)
|
||||
if not np.array_equal(new_points, old_points):
|
||||
self.refresh_triangulation()
|
||||
self.refresh_unit_normal()
|
||||
return self
|
||||
|
||||
return wrapper
|
||||
|
||||
@triggers_refreshed_triangulation
|
||||
def set_points(self, points):
|
||||
super().set_points(points)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue