Skip to content

Commit f4f7387

Browse files
committed
Code cleanup
1 parent f4f2f46 commit f4f7387

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

manim/mobject/text/text_mobject.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,14 @@ def remove_invisible_chars(mobject: SVGMobject) -> SVGMobject:
9494
:class:`~.SVGMobject`
9595
The SVGMobject without unwanted invisible characters.
9696
"""
97-
if mobject.__class__.__name__ == "Text":
98-
return exclude_dots_from_mobject(mobject[:])
99-
elif mobject.__class__.__name__ == "Code":
100-
mobject.code = exclude_dots_from_mobject(mobject.code)
101-
return mobject
102-
else:
103-
return exclude_dots_from_mobject(mobject)
104-
105-
106-
def exclude_dots_from_mobject(mobject: SVGMobject) -> SVGMobject:
10797
mobject_without_dots = VGroup()
108-
if mobject[0].__class__ == VGroup:
109-
for i in range(len(mobject)):
110-
mobject_without_dots.add(VGroup())
111-
mobject_without_dots[i].add(*(k for k in mobject[i] if k.__class__ != Dot))
98+
if isinstance(mobject[0], VGroup):
99+
for submob in mobject:
100+
mobject_without_dots.add(
101+
VGroup(k for k in submob if not isinstance(k, Dot))
102+
)
112103
else:
113-
mobject_without_dots.add(*(k for k in mobject if k.__class__ != Dot))
104+
mobject_without_dots.add(*(k for k in mobject if not isinstance(k, Dot)))
114105
return mobject_without_dots
115106

116107

0 commit comments

Comments
 (0)