doxypypy
doxypypy copied to clipboard
How to document class-instance variables?
I am working on an older project that documents classes like this:
class Version:
"""
Parse and compare AsciiDoc version numbers.
Instance attributes:
string: String version number 'major.minor[.micro][suffix]'.
major: Integer major version number.
minor: Integer minor version number.
micro: Integer micro version number.
suffix: Suffix (begins with non-numeric character) is ignored when comparing.
Examples:
>>> Version('8.2.5') < Version('8.3 beta 1')
True
>>> Version('8.3.0') == Version('8.3. beta 1')
True
etc.
"""
def __init__(self, version):
self.string = version #!< comment like this does not work
reo = re.match(r'^(\d+)\.(\d+)(\.(\d+))?\s*(.*?)\s*$', self.string)
if not reo:
raise ValueError('invalid version number: %s' % self.string)
groups = reo.groups()
self.major = int(groups[0])
self.minor = int(groups[1])
self.micro = int(groups[3] or '0')
self.suffix = groups[4] or ''
The Instance attributes:
could be replaced by Attributes:
. Then the docstring is nicely formatted, but the subtitle is misleading. Doxygen extracts "Public Attributes" from the __init__()
; however, I did not find a way how to document them. If it were possible, I would remove it from docstring. Is there any recommended way?
Also the string: String version number 'major.minor[.micro][suffix]'.
was earlier string: String version number '<major>.<minor>[.<micro>][<suffix>]'.
-- nor doxypypy nor Doxygen html escaped the angle brackets. Could this be done by doxypypy?
So are you asking to add something like Public Attributes to doxypypy or if there's a good way to ignore them?
Maybe. I'm not sure offhand what Doxygen would do with them if we escaped them and passed them along.
@Feneric I see that the topic is quite dead but I'll revive it little:
Is there a way to document public attributes in doxypypy?