mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fix type bug
This commit is contained in:
parent
fc4f649570
commit
461500637e
2 changed files with 6 additions and 6 deletions
|
@ -187,8 +187,9 @@ class LabelledString(_StringSVG):
|
|||
inserted_string_pairs: list[tuple[Span, tuple[str, str]]],
|
||||
other_repl_items: list[tuple[Span, str]]
|
||||
) -> dict[Span, str]:
|
||||
result = dict(other_repl_items)
|
||||
if not inserted_string_pairs:
|
||||
return other_repl_items.copy()
|
||||
return result
|
||||
|
||||
indices, _, _, inserted_strings = zip(*sorted([
|
||||
(
|
||||
|
@ -200,12 +201,11 @@ class LabelledString(_StringSVG):
|
|||
for span, str_pair in inserted_string_pairs
|
||||
for flag in range(2)
|
||||
]))
|
||||
result = {
|
||||
result.update({
|
||||
(index, index): "".join(inserted_strings[slice(*item_span)])
|
||||
for index, item_span
|
||||
in LabelledString.compress_neighbours(indices)
|
||||
}
|
||||
result.update(other_repl_items)
|
||||
})
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
|
@ -272,7 +272,7 @@ class LabelledString(_StringSVG):
|
|||
return (0, len(self.string))
|
||||
|
||||
def get_space_spans(self) -> list[Span]:
|
||||
return self.find_spans(r"\s+")
|
||||
return self.find_spans(r"\s")
|
||||
|
||||
# Parsing
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ class MarkupText(LabelledString):
|
|||
|
||||
def get_label_span_list(self) -> list[Span]:
|
||||
breakup_indices = remove_list_redundancies(list(it.chain(*it.chain(
|
||||
self.space_spans,
|
||||
self.find_spans(r"\s+"),
|
||||
self.find_spans(r"\b"),
|
||||
self.specified_spans
|
||||
))))
|
||||
|
|
Loading…
Add table
Reference in a new issue