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
ab98fc9a
"olla/ssh:/git@developer.sourcefind.cn:2222/tsoc/openmm.git" did not exist on "5866a98feef8ec660ed1c2ffdb4b59e23e4dfbc1"
Commit
ab98fc9a
authored
Nov 04, 2015
by
Robert McGibbon
Browse files
Unused
parent
61ca19f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
60 deletions
+0
-60
wrappers/python/filterPythonFiles.py
wrappers/python/filterPythonFiles.py
+0
-60
No files found.
wrappers/python/filterPythonFiles.py
deleted
100644 → 0
View file @
61ca19f8
from
__future__
import
print_function
import
sys
# 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
:
break
stripped
=
line
.
lstrip
()
if
stripped
.
startswith
(
'def'
)
or
stripped
.
startswith
(
'class'
):
prefix
=
line
[:
len
(
line
)
-
len
(
stripped
)]
split
=
stripped
.
split
()
if
split
[
0
]
==
'class'
and
split
[
1
][
0
].
islower
():
# Classes that start with a lowercase letter were defined by SWIG. We want to hide them.
print
(
"%s## @private"
%
prefix
)
if
split
[
1
][
0
]
==
'_'
and
split
[
1
][
1
]
!=
'_'
:
# Names starting with a single _ are assumed to be private.
print
(
"%s## @private"
%
prefix
)
# We're at the start of a class or function definition. Find all lines that contain the declaration.
declaration
=
line
while
len
(
line
)
>
0
and
line
.
find
(
':'
)
==
-
1
:
line
=
input
.
readline
()
declaration
+=
line
# Now look for a docstring.
docstrings
=
[]
line
=
input
.
readline
()
stripped
=
line
.
lstrip
()
if
stripped
.
startswith
(
'"""'
):
line
=
stripped
[
3
:]
readingParameters
=
False
while
line
.
find
(
'"""'
)
==
-
1
:
docstrings
.
append
(
line
)
line
=
input
.
readline
()
if
line
.
strip
()
==
'Parameters:'
:
readingParameters
=
True
line
=
input
.
readline
()
stripped
=
line
.
lstrip
()
if
readingParameters
and
stripped
.
startswith
(
'- '
):
line
=
"@param %s"
%
stripped
[
2
:]
elif
stripped
.
startswith
(
'Returns:'
):
line
=
"@return %s"
%
stripped
[
8
:]
line
=
line
[:
line
.
find
(
'"""'
)]
docstrings
.
append
(
line
)
# Print out the docstring in Doxygen syntax, followed by the declaration.
for
s
in
docstrings
:
print
(
"%s##%s"
%
(
prefix
,
s
.
strip
()))
print
(
declaration
)
if
len
(
docstrings
)
==
0
:
print
(
line
)
else
:
print
(
line
)
\ No newline at end of file
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