summaryrefslogtreecommitdiff
path: root/giscanner/docwriter.py
diff options
context:
space:
mode:
Diffstat (limited to 'giscanner/docwriter.py')
-rw-r--r--giscanner/docwriter.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py
index 9d0d5b8f..9b27e0d9 100644
--- a/giscanner/docwriter.py
+++ b/giscanner/docwriter.py
@@ -386,7 +386,14 @@ class DocFormatterC(DocFormatter):
def get_parameters(self, node):
return node.all_parameters
-class DocFormatterPython(DocFormatter):
+class DocFormatterIntrospectableBase(DocFormatter):
+ def should_render_node(self, node):
+ if isinstance(node, ast.Record) and node.is_gtype_struct_for is not None:
+ return False
+
+ return True
+
+class DocFormatterPython(DocFormatterIntrospectableBase):
language = "Python"
mime_type = "text/python"
@@ -400,10 +407,7 @@ class DocFormatterPython(DocFormatter):
if getattr(node, "is_constructor", False):
return False
- if isinstance(node, ast.Record) and node.is_gtype_struct_for is not None:
- return False
-
- return True
+ return super(DocFormatterPython, self).should_render_node(node)
def is_method(self, node):
if getattr(node, "is_method", False):
@@ -467,7 +471,7 @@ class DocFormatterPython(DocFormatter):
def get_parameters(self, node):
return node.all_parameters
-class DocFormatterGjs(DocFormatter):
+class DocFormatterGjs(DocFormatterIntrospectableBase):
language = "Gjs"
mime_type = "text/x-gjs"
@@ -477,12 +481,6 @@ class DocFormatterGjs(DocFormatter):
"NULL": "null",
}
- def should_render_node(self, node):
- if isinstance(node, ast.Record) and node.is_gtype_struct_for is not None:
- return False
-
- return True
-
def is_method(self, node):
if getattr(node, "is_method", False):
return True