mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
cleanup: Use functools.cached_property
This commit is contained in:
parent
3b22dff988
commit
a0e9f647d1
4 changed files with 14 additions and 27 deletions
|
@ -18,10 +18,10 @@
|
|||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import typing as T
|
||||
from functools import cached_property
|
||||
import os, sys
|
||||
|
||||
from .errors import CompileError, CompilerBugError
|
||||
from .utils import lazy_prop
|
||||
from . import xml_reader
|
||||
|
||||
|
||||
|
@ -149,30 +149,30 @@ class GirNode:
|
|||
else:
|
||||
return self.container.get_containing(container_type)
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def glib_type_name(self):
|
||||
return self.xml["glib:type-name"]
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def full_name(self):
|
||||
if self.container is None:
|
||||
return self.name
|
||||
else:
|
||||
return f"{self.container.name}.{self.name}"
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def name(self) -> str:
|
||||
return self.xml["name"]
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def cname(self) -> str:
|
||||
return self.xml["c:type"]
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def available_in(self) -> str:
|
||||
return self.xml.get("version")
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def doc(self) -> T.Optional[str]:
|
||||
sections = []
|
||||
|
||||
|
@ -276,15 +276,15 @@ class Class(GirNode, GirType):
|
|||
result += " implements " + ", ".join(self.implements)
|
||||
return result
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def properties(self):
|
||||
return {p.name: p for p in self._enum_properties()}
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def signals(self):
|
||||
return {s.name: s for s in self._enum_signals()}
|
||||
|
||||
@lazy_prop
|
||||
@cached_property
|
||||
def parent(self):
|
||||
if self._parent is None:
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue