cleanup: Use functools.cached_property

This commit is contained in:
James Westman 2022-02-23 15:39:15 -06:00
parent 3b22dff988
commit a0e9f647d1
4 changed files with 14 additions and 27 deletions

View file

@ -19,11 +19,10 @@
from collections import defaultdict
from functools import cached_property
import typing as T
from xml import sax
from .utils import lazy_prop
# To speed up parsing, we ignore all tags except these
PARSE_GIR = set(
@ -53,7 +52,7 @@ class Element:
self.children: T.Dict[str, T.List["Element"]] = defaultdict(list)
self.cdata_chunks: T.List[str] = []
@lazy_prop
@cached_property
def cdata(self):
return "".join(self.cdata_chunks)