Skip to content

Conversation

@kimt33
Copy link
Owner

@kimt33 kimt33 commented Jun 12, 2019

Using sphinxcontrib.napoleon's parser, we can extract the necessary information to build Docstring instance. However, napoleon's parser converts directly to rst format rather than storing the intermediate information, so the internal structure of napoleon's parsers need to be modified.

Depends on PR #2

kimt33 added 9 commits June 9, 2019 15:51
This should make the protect against testing against the current directory
rather than the installed package
1. Add environment specifically for linters (black, pydocstring, import-order,
pep8 naming, bandit, flake8, pylint)
2. Add config for linters
3. Fix import orders
4. Fix missing docstring
5. Fix elif statements with raise statement
Branch was not getting covered because generator was not being exhausted. That's
not an issue because only the first entry is interesting
1. Remove DocContent.make_numpy_docstring, DocContent.make_google_docstring,
DocContent.make_rst_docstring
2. Add DocContent.make_docstring that calls the correct method for the given
style via name of the method
3. Change name of the methods from make_numpy_docstring to make_docstring_numpy,
from make_numpy_docstring_signature to make_docstring_numpy_signature, from
make_google_docstring to make_docstring_google, and from make_rst_docstring to
make_docstring_rst.

Having multiple abstract methods in DocSection for different styles of docstring
seems to get more complicated as the number of styles increases. If the goal is
to make it easier to create docstrings of new styles, then we can just add more
styles to the subclasses without having to add more functions at the base class.

I'm not 100% sure that the best way is to keep adding methods for each
style (this would result in the class growing quite quickly). Maybe it'd be
better to organize the modules by the styles also i.e. make a subclass for each
child of DocSection specific for the style.
1. Remove DocContent.__init__
2. Create Empty class for testing in the module rather than in test functions.

It seems that an abstract __init__ doesn't really do much except for preventing
any initialization. Though it does serve a purpose, it seems to complicate the
code more than it adds anything
1. Remove `default_style`
2. Format strings
3. Remove docstrings and tests for default_style

At the moment, it does not seem necessary to add an attribute does nothing
except to store the default value. This may be useful for making some porcelain
later, but it is not ncessary at the moment.
1. Tweak napoleon's parsers to return docinstance compatible objects
2. Add NumpyDoc parser for see also section. Copied from napoleon's copy
3. Add new description for entries of see also section
4. Add numpy's special docstring for see also
5. Add test
6. Skip tests for napoleon
7. Add extra installations for napoleon

Time: 7h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants