Skip to content

Commit 8981a52

Browse files
naveen521kkleotrs
andauthored
Apply some formatting changes
Co-authored-by: Leo Torres <[email protected]>
1 parent dbef5d3 commit 8981a52

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

manim/mobject/svg/text_mobject.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def __init__(self, text: str, **config):
685685
self.scale(TEXT_MOB_SCALE_FACTOR)
686686

687687
def remove_last_M(self, file_name: str):
688-
"""Internally used function. Use to format the rendered SVG files."""
688+
"""Internally used. Use to format the rendered SVG files."""
689689
with open(file_name, "r") as fpr:
690690
content = fpr.read()
691691
content = re.sub(r'Z M [^A-Za-z]*? "\/>', 'Z "/>', content)
@@ -717,7 +717,7 @@ def full2short(self, config):
717717
text2weight -> t2w
718718
"""
719719
for kwargs in [config, self.CONFIG]:
720-
if kwargs.__contains__("text2color"):
720+
if "text2color" in kwargs:
721721
kwargs["t2c"] = kwargs.pop("text2color")
722722
if kwargs.__contains__("text2font"):
723723
kwargs["t2f"] = kwargs.pop("text2font")
@@ -736,14 +736,14 @@ def set_color_by_t2c(self, t2c=None):
736736
self.chars[start:end].set_color(color)
737737

738738
def set_color_by_t2g(self, t2g=None):
739-
"""Internally used function.Sets gradient colours for specified strings. Same as ``set_color_by_t2c``."""
739+
"""Internally used. Sets gradient colors for specified strings. Behaves similarly to ``set_color_by_t2c``."""
740740
t2g = t2g if t2g else self.t2g
741741
for word, gradient in list(t2g.items()):
742742
for start, end in self.find_indexes(word, self.original_text):
743743
self.chars[start:end].set_color_by_gradient(*gradient)
744744

745745
def str2style(self, string):
746-
"""Internally used function. Converts text to Pango Understandable Styles/"""
746+
"""Internally used function. Converts text to Pango Understandable Styles."""
747747
if string == NORMAL:
748748
return pangocffi.Style.NORMAL
749749
elif string == ITALIC:
@@ -795,9 +795,7 @@ def text2hash(self):
795795
return hasher.hexdigest()[:16]
796796

797797
def text2settings(self):
798-
"""Internally used function.
799-
Convets the texts and styles to a setting for parsing
800-
"""
798+
"""Internally used function. Converts the texts and styles to a setting for parsing."""
801799
settings = []
802800
t2x = [self.t2f, self.t2s, self.t2w]
803801
for i in range(len(t2x)):
@@ -807,7 +805,7 @@ def text2settings(self):
807805
for start, end in self.find_indexes(word, self.text):
808806
fsw[i] = x
809807
settings.append(TextSetting(start, end, *fsw))
810-
# Set All text settings(default font slant weight)
808+
# Set all text settings (default font, slant, weight)
811809
fsw = [self.font, self.slant, self.weight]
812810
settings.sort(key=lambda setting: setting.start)
813811
temp_settings = settings.copy()

0 commit comments

Comments
 (0)