-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add type annotations to text_mobject.py
#4381
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
base: main
Are you sure you want to change the base?
Add type annotations to text_mobject.py
#4381
Conversation
Error count: 156
# Conflicts: # manim/camera/camera.py # manim/mobject/svg/svg_mobject.py # manim/mobject/text/code_mobject.py # manim/mobject/text/numbers.py # manim/mobject/text/tex_mobject.py # manim/mobject/types/image_mobject.py # mypy.ini
# Conflicts: # mypy.ini
# Conflicts: # manim/mobject/text/text_mobject.py # mypy.ini
@@ -120,7 +120,7 @@ | |||
self.should_center = should_center | |||
self.svg_height = height | |||
self.svg_width = width | |||
self.color = color | |||
self.color = ManimColor(color) |
Check warning
Code scanning / CodeQL
Overwriting attribute in super-class or sub-class Warning
Mobject
@@ -110,6 +120,7 @@ | |||
else: | |||
mobject_without_dots.add(*(k for k in mobject if k.__class__ != Dot)) | |||
if iscode: | |||
assert isinstance(code, Code) |
Check failure
Code scanning / CodeQL
Potentially uninitialized local variable Error
@deprecated( | ||
since="v0.14.0", | ||
until="v0.15.0", | ||
message="This was internal function, you shouldn't be using it anyway.", | ||
) | ||
def _set_color_by_t2c(self, t2c=None): | ||
"""Sets color for specified strings.""" | ||
t2c = t2c if t2c else self.t2c | ||
for word, color in list(t2c.items()): | ||
for start, end in self._find_indexes(word, self.text): | ||
self.chars[start:end].set_color(color) | ||
|
||
@deprecated( | ||
since="v0.14.0", | ||
until="v0.15.0", | ||
message="This was internal function, you shouldn't be using it anyway.", | ||
) | ||
def _set_color_by_t2g(self, t2g=None): | ||
"""Sets gradient colors for specified | ||
strings. Behaves similarly to ``set_color_by_t2c``. | ||
""" | ||
t2g = t2g if t2g else self.t2g | ||
for word, gradient in list(t2g.items()): | ||
for start, end in self._find_indexes(word, self.text): | ||
self.chars[start:end].set_color_by_gradient(*gradient) | ||
|
||
def _text2hash(self, color: ManimColor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this part of the code that was marked as deprecated.
Overview: What does this pull request change?
Reviewer Checklist