From 4b235f3ef9c3e055fdc4746af43034d68009a664 Mon Sep 17 00:00:00 2001 From: 5j9 <5j9@users.noreply.github.com> Date: Thu, 18 Apr 2024 07:09:48 +0330 Subject: [PATCH] chore: remove unused _shadow_cache --- wikitextparser/_parser_function.py | 5 +---- wikitextparser/_wikitext.py | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/wikitextparser/_parser_function.py b/wikitextparser/_parser_function.py index d336961..a409890 100644 --- a/wikitextparser/_parser_function.py +++ b/wikitextparser/_parser_function.py @@ -60,10 +60,7 @@ def arguments(self) -> List[Argument]: else: arg_span = old_span arg = Argument(lststr, type_to_spans, arg_span, type_, self) - arg._shadow_cache = ( - lststr[0][s:e], - shadow[arg_self_start:arg_self_end], - ) + arg._span_data[3] = shadow[arg_self_start:arg_self_end] arguments_append(arg) return arguments diff --git a/wikitextparser/_wikitext.py b/wikitextparser/_wikitext.py index f8bd54c..d07af44 100644 --- a/wikitextparser/_wikitext.py +++ b/wikitextparser/_wikitext.py @@ -204,7 +204,7 @@ class WikiText: # The following class attribute acts as a default value. _type = 'WikiText' - __slots__ = '_type_to_spans', '_lststr', '_span_data', '_shadow_cache' + __slots__ = '_type_to_spans', '_lststr', '_span_data' def __init__( self, @@ -232,7 +232,6 @@ def __init__( if _type not in SPAN_PARSER_TYPES: type_to_spans = self._type_to_spans = parse_to_spans(byte_array) type_to_spans[_type] = [span] - self._shadow_cache = string, byte_array else: # In SPAN_PARSER_TYPES, we can't pass the original byte_array to # parser to generate the shadow because it will replace the whole @@ -250,7 +249,6 @@ def __init__( byte_array[0] = 3 byte_array[-1] = 32 type_to_spans = parse_to_spans(byte_array) - self._shadow_cache = string, byte_array type_to_spans[_type].insert(0, span) self._type_to_spans = type_to_spans if type(self) is Parameter: