Add ability to hide undocumented methods, etc.

pull/9/head
Eric Holscher 9 years ago
parent 732942828f
commit bdae9f083c

@ -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'

@ -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 %}
Loading…
Cancel
Save