Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
df7bbe05
Commit
df7bbe05
authored
Nov 03, 2015
by
Robert McGibbon
Browse files
Clean up some extended summary docstrings
parent
05544a8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
wrappers/python/filterPythonFiles.py
wrappers/python/filterPythonFiles.py
+8
-6
No files found.
wrappers/python/filterPythonFiles.py
View file @
df7bbe05
...
...
@@ -2,6 +2,7 @@ from __future__ import print_function
from
numpydoc.docscrape
import
NumpyDocString
import
sys
import
textwrap
from
inspect
import
cleandoc
# Doxygen does a bad job of generating documentation based on docstrings. This script is run as a filter
...
...
@@ -38,21 +39,22 @@ while True:
if
stripped
.
startswith
(
'"""'
)
or
stripped
.
startswith
(
"'''"
):
line
=
stripped
[
3
:]
readingParameters
=
False
if
line
.
find
(
'"""'
)
!=
-
1
or
line
.
find
(
(
"'''"
)
)
!=
-
1
:
if
line
.
find
(
'"""'
)
!=
-
1
or
line
.
find
(
"'''"
)
!=
-
1
:
docstringlines
.
append
(
line
.
rstrip
()[:
-
3
])
else
:
while
line
.
find
(
'"""'
)
==
-
1
:
while
line
.
find
(
'"""'
)
==
-
1
and
line
.
find
(
"'''"
)
==
-
1
:
docstringlines
.
append
(
line
)
line
=
input
.
readline
()
docstring
=
NumpyDocString
(
''
.
join
(
docstringlines
))
docstring
=
NumpyDocString
(
cleandoc
(
''
.
join
(
docstringlines
)))
# Print out the docstring in Doxygen syntax, followed by the declaration.
sep
=
'
\n
{prefix}##
\n
{prefix}## '
.
format
(
prefix
=
prefix
)
for
line
in
textwrap
.
wrap
(
' '
.
join
(
docstring
[
'Summary'
])):
for
line
in
docstring
[
'Summary'
]:
print
(
'{prefix}## {line}'
.
format
(
prefix
=
prefix
,
line
=
line
))
if
len
(
docstring
[
'Extended Summary'
])
>
0
:
print
(
'{prefix}##'
.
format
(
prefix
=
prefix
))
print
(
'{prefix}## {ext_summary}'
.
format
(
prefix
=
prefix
,
ext_summary
=
sep
.
join
(
docstring
[
'Extended Summary'
])))
for
line
in
docstring
[
'Extended Summary'
]:
print
(
'{prefix}## {line}'
.
format
(
prefix
=
prefix
,
line
=
line
.
strip
()))
print
(
'{prefix}##'
.
format
(
prefix
=
prefix
))
for
name
,
type
,
descr
in
docstring
[
'Parameters'
]:
print
(
'{prefix}## @param {name} ({type}) {descr}'
.
format
(
prefix
=
prefix
,
type
=
type
,
name
=
name
,
descr
=
''
.
join
(
descr
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment