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
8e6bae8b
"plugins/amoeba/openmmapi/vscode:/vscode.git/clone" did not exist on "7197b6c687e60e8a946dec63bf04e7bb41abb576"
Commit
8e6bae8b
authored
Nov 05, 2015
by
Robert McGibbon
Browse files
Fix some issues with generating doxygen python API docs
parent
c8443904
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
15 deletions
+25
-15
wrappers/python/filterPythonFiles.py
wrappers/python/filterPythonFiles.py
+25
-15
No files found.
wrappers/python/filterPythonFiles.py
View file @
8e6bae8b
from
__future__
import
print_function
from
numpydoc.docscrape
import
NumpyDocString
import
re
import
sys
import
textwrap
from
inspect
import
cleandoc
from
numpydoc.docscrape
import
NumpyDocString
# Doxygen does a bad job of generating documentation based on docstrings. This script is run as a filter
# on each file, and converts the docstrings into Doxygen style comments so we get better documentation.
# Doxygen does a bad job of generating documentation based on docstrings.
# This script is run as a filter
# on each file, and converts the docstrings into Doxygen style comments
# so we get better documentation.
input
=
open
(
sys
.
argv
[
1
])
while
True
:
line
=
input
.
readline
()
if
len
(
line
)
==
0
:
...
...
@@ -32,21 +37,26 @@ while True:
declaration
+=
line
# Now look for a docstring.
docstringlines
=
[]
line
=
input
.
readline
()
stripped
=
line
.
lstrip
()
if
stripped
.
startswith
(
'"""'
)
or
stripped
.
startswith
(
"'''"
):
line
=
stripped
[
3
:]
while
line
.
find
(
'"""'
)
==
-
1
and
line
.
find
(
"'''"
)
==
-
1
:
docstringlines
.
append
(
line
)
line
=
input
.
readline
().
rstrip
()
if
line
.
endswith
(
'"""'
)
or
line
.
endswith
(
"'''"
):
docstringlines
.
append
(
line
[:
-
3
])
l
=
line
.
strip
()
if
l
.
startswith
(
'"""'
)
or
l
.
startswith
(
"'''"
):
if
l
.
count
(
'"""'
)
==
2
or
l
.
count
(
"'''"
)
==
2
:
docstringlines
.
append
(
l
[
3
:
-
3
])
else
:
docstringlines
.
append
(
l
[
3
:])
line
=
input
.
readline
()
l
=
line
.
strip
()
while
l
.
find
(
'"""'
)
==
-
1
and
l
.
find
(
"'''"
)
==
-
1
:
docstringlines
.
append
(
line
.
rstrip
())
line
=
input
.
readline
()
l
=
line
.
strip
()
if
line
.
rstrip
().
endswith
(
'"""'
)
or
line
.
rstrip
().
endswith
(
"'''"
):
# last line
docstringlines
.
append
(
line
.
rstrip
()[:
-
3
])
docstring
=
NumpyDocString
(
cleandoc
(
'
\n
'
.
join
(
docstringlines
)))
# print(docstringlines)
# Print out the docstring in Doxygen syntax, followed by the declaration.
for
line
in
docstring
[
'Summary'
]:
...
...
@@ -63,7 +73,7 @@ while True:
type
=
name
print
(
'{prefix}## @return ({type}) {descr}'
.
format
(
prefix
=
prefix
,
type
=
type
,
name
=
name
,
descr
=
''
.
join
(
descr
)))
print
(
declaration
)
print
(
declaration
,
end
=
''
)
if
len
(
docstringlines
)
==
0
:
print
(
line
,
end
=
''
)
else
:
...
...
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