Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GooglePreprocessor and SmartPreprocessor #84

Merged
merged 15 commits into from
Aug 20, 2019

Conversation

vemel
Copy link

@vemel vemel commented Aug 15, 2019

GooglePreprocessor - supports Google format for docstrings
SmartPreprocessor - wisely chooses between RST and Google preprocessors for each docstring

Copy link
Owner

@NiklasRosenstein NiklasRosenstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please go back to two-space for this PR so I can properly review the actual changes. We can think about converting the code base to four-space in another PR.

pydocmd/loader.py Outdated Show resolved Hide resolved
pydocmd/preprocessors/smart.py Show resolved Hide resolved
@NiklasRosenstein
Copy link
Owner

NiklasRosenstein commented Aug 16, 2019

Please also be aware that I'm working on a new version that parses the code with lib2to3 instead of executing the code on the develop branch. It's actually not far from being merged into master and 2.x being moved into its own branch.

Anyway, happy to merge your PR into the 2.x code base. I'll likely copy the processor code to the 3.x branch afterwards.

@vemel
Copy link
Author

vemel commented Aug 16, 2019

Rebased to master, should be no conflicts now.

pydocmd/__main__.py Outdated Show resolved Hide resolved
@NiklasRosenstein
Copy link
Owner

Please take a look at the pr-84 branch. I've added some unit tests. Could you take a look at why the smart preprocessor does not detect the Google syntax properly? 😃

@vemel
Copy link
Author

vemel commented Aug 16, 2019

I will take a look, thanks! Actually, I implemented GooglePrerocessor incorrectly, it also supports https://www.python.org/dev/peps/pep-0257 we should probably split these two guys, and we can create a parent class for them as methods will be the same, just param regexps should be different.

FOr now logic for detecting docstring style is quite simple. If I find a section from Google/PEP-0257 -
(e.g. Args:) I use GooglePreprocessor. Otherwise, RST is used.

@vemel
Copy link
Author

vemel commented Aug 16, 2019

Please take a look at the pr-84 branch. I've added some unit tests. Could you take a look at why the smart preprocessor does not detect the Google syntax properly?

Fixed, regexp was incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants