diff --git a/autoapi/domains/python.py b/autoapi/domains/python.py index 33b4620..dc6ac59 100644 --- a/autoapi/domains/python.py +++ b/autoapi/domains/python.py @@ -82,6 +82,27 @@ class PythonBase(PythonMapperBase): # For later self.item_map = defaultdict(list) + @property + def undoc_member(self): + return self.docstring == '' + + @property + def private_member(self): + return self.name[0] == '_' + + @property + def special_member(self): + return self.name[0:1] == ['_', '_'] + + def display(self, options): + if self.undoc_member and 'undoc-members' not in options: + return False + if self.private_member and 'private-members' not in options: + return False + if self.special_member and 'special-members' not in options: + return False + return True + class PythonFunction(PythonBase): type = 'function' diff --git a/autoapi/templates/python/function.rst b/autoapi/templates/python/function.rst index eed6ddc..aa9bc7d 100644 --- a/autoapi/templates/python/function.rst +++ b/autoapi/templates/python/function.rst @@ -1,3 +1,5 @@ +{%- if obj.display(options) %} + {%- if is_method %} {# Slice self off #} .. method:: {{ obj.name.split('.')[-1] }}({{ args[1:]|join(',') }}) @@ -8,3 +10,5 @@ {%- if obj.docstring %} {{ obj.docstring.strip()|indent(3) }} {% endif %} + +{% endif %} \ No newline at end of file