Repository navigation
Allow api docs to be truncated and used for other purposes - #556
Conversation
This is essentually the same Click does: https://click.palletsprojects.com/en/7.x/documentation/#truncating-help-texts It allows splitting the documenting text so that the lower part may be used to describe the function further, e.g. extracting information using Sphinx.
| self.description = description or inspect.cleandoc(self.endpoint.__doc__ or "") | ||
| # if a form feed (page break) is found in the description text, truncate | ||
| # description text to the content preceding the first form feed | ||
| if self.description and "\f" in self.description: |
There was a problem hiding this comment.
No need to check for "\f" in self.description; the first result of split will just be the whole string in that case
|
This seems like a nice, simple addition. Using |
Codecov Report
@@ Coverage Diff @@
## master #556 +/- ##
======================================
Coverage 100% 100%
======================================
Files 251 257 +6
Lines 5988 6270 +282
======================================
+ Hits 5988 6270 +282
Continue to review full report at Codecov.
|
|
I simplified the splitting, thanks for pointing it out. |
|
Oh also, the formatting is wrong (in at least one of the test files) -- run |
|
Okay, done. Sorry for the noise. I didn't know you could define functions without a body, but the test suite confirms it. I lean something new every day :) |
|
The reason it works is because it has a docstring - so technically it does have a body :). At least, it has enough of one for python to not raise a syntax error. If you drop the docstring it will error. |
This is essentually the same Click does:
https://click.palletsprojects.com/en/7.x/documentation/#truncating-help-texts
It allows splitting the documenting text so that the lower part may be
used to describe the function further, e.g. extracting information using
Sphinx.