From ec075fe8e4a307f788113271e4011645346ad98b Mon Sep 17 00:00:00 2001 From: 5j9 <5j9@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:09:43 +0330 Subject: [PATCH] chore(_inner_type_to_spans_copy): avoid deepcopy I have not tested it, but deepcopy tries to avoid circular references and is probably slower. --- wikitextparser/_wikitext.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/wikitextparser/_wikitext.py b/wikitextparser/_wikitext.py index e39f620..12c67fa 100644 --- a/wikitextparser/_wikitext.py +++ b/wikitextparser/_wikitext.py @@ -1,5 +1,4 @@ from bisect import bisect_left, bisect_right, insort_right -from copy import deepcopy from html import unescape from itertools import compress, islice from operator import attrgetter @@ -621,8 +620,6 @@ def _inner_type_to_spans_copy(self) -> Dict[str, List[List[int]]]: self.string. """ ss, se, _, _ = self._span_data - if ss == 0 and se == len(self._lststr[0]): - return deepcopy(self._type_to_spans) return { type_: [ [s - ss, e - ss, m, ba[:] if ba is not None else None]