Use cached_property instead of a custom decorator

This commit is contained in:
James Westman 2022-03-16 16:06:00 -05:00
parent 1c1a5e3266
commit f197e68589
4 changed files with 15 additions and 28 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([
@ -40,7 +39,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)