mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-06 09:20:27 +00:00
f607d5e1db
* Moves relative path parsing away from the base mapper implementation * Change argument parsing from splitting first line of source with ',' to use AST traversal instead. This is not complete, but mostly PoC for now. Full traversal into argument type nodes will allow us to get nested dict() etc. We should open a ticket to track this work * Cleans up some of the templates to reduce duplicate titles * Adds a directive for nesting rST from constructs that might have headings. Remove the first heading in this case to address the case where a module has a docstring with a heading up front * Adds tests * Replaces example module with module that has more failing cases of parsing Closes #78 Fixes #80 Fixes #81 Fixes #82 Fixes #83 Fixes #84 Fixes #85
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
"""Example module
|
|
|
|
This is a description
|
|
"""
|
|
|
|
|
|
class Foo(object):
|
|
|
|
class_var = 42 #: Class var docstring
|
|
|
|
another_class_var = 42
|
|
"""Another class var docstring"""
|
|
|
|
class Meta(object):
|
|
"""A nested class just to test things out"""
|
|
|
|
@classmethod
|
|
def foo():
|
|
"""The foo class method"""
|
|
return True
|
|
|
|
def method_okay(self, foo=None, bar=None):
|
|
"""This method should parse okay"""
|
|
return True
|
|
|
|
def method_multiline(self, foo=None, bar=None,
|
|
baz=None):
|
|
"""This is on multiple lines, but should parse okay too
|
|
|
|
pydocstyle gives us lines of source. Test if this means that multiline
|
|
definitions are covered in the way we're anticipating here
|
|
"""
|
|
return True
|
|
|
|
def method_tricky(self, foo=None, bar=dict(foo=1, bar=2)):
|
|
"""This will likely fail our argument testing
|
|
|
|
We parse naively on commas, so the nested dictionary will throw this off
|
|
"""
|
|
return True
|