[gi-docgen/ebassi/deprecated-since: 2/3] gir: Simplify deprecation check
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gi-docgen/ebassi/deprecated-since: 2/3] gir: Simplify deprecation check
- Date: Mon, 31 Jan 2022 00:11:18 +0000 (UTC)
commit 8a3af64fe57d660ec7b326e1e14cc8217c83f592
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Jan 31 00:04:44 2022 +0000
gir: Simplify deprecation check
Add a proxy for the deprecation bit, and return placeholder values in
case version or message are missing.
gidocgen/gir/ast.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gidocgen/gir/ast.py b/gidocgen/gir/ast.py
index 621c241..fbac892 100644
--- a/gidocgen/gir/ast.py
+++ b/gidocgen/gir/ast.py
@@ -151,12 +151,18 @@ class GIRElement:
def available_since(self) -> T.Optional[str]:
return self.info.version
+ @property
+ def deprecated(self) -> bool:
+ return self.info.deprecated
+
@property
def deprecated_since(self) -> T.Optional[T.Tuple[str, str]]:
- version = self.info.deprecated_version
- if version is None:
+ if not self.info.deprecated:
return None
+ version = self.info.deprecated_version
message = self.info.deprecated_msg
+ if version is None:
+ version = "Unknown"
if message is None:
message = "Please do not use it in newly written code"
return (version, message)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]