pep257 & numpydoc conforming docstrings

This commit is contained in:
xantares 2015-04-13 11:15:18 +02:00 committed by William S Fulton
commit 92328a2016
4 changed files with 156 additions and 124 deletions

View file

@ -23,8 +23,8 @@ if not is_new_style_class(A):
# skip builtin check - the autodoc is missing, but it probably should not be
skip = True
check(A.__doc__, "Proxy of C++ A class", "::A")
check(A.funk.__doc__, "just a string")
check(A.__doc__, "Proxy of C++ A class.", "::A")
check(A.funk.__doc__, "just a string.")
check(A.func0.__doc__,
"func0(self, arg2, hello) -> int",
"func0(arg2, hello) -> int")
@ -35,17 +35,19 @@ check(A.func2.__doc__,
"\n"
" func2(self, arg2, hello) -> int\n"
"\n"
" Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" Parameters\n"
" ----------\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func2(arg2, hello) -> int\n"
"\n"
"Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"Parameters\n"
"----------\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
@ -53,17 +55,19 @@ check(A.func3.__doc__,
"\n"
" func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" Parameters\n"
" ----------\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func3(short arg2, Tuple hello) -> int\n"
"\n"
"Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"Parameters\n"
"----------\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
@ -92,35 +96,39 @@ check(A.func2default.__doc__,
"\n"
" func2default(self, e, arg3, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func2default(self, e, arg3, hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func2default(e, arg3, hello, f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
"f: double\n"
"\n"
"func2default(e, arg3, hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
@ -128,35 +136,39 @@ check(A.func3default.__doc__,
"\n"
" func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func3default(A self, A e, short arg3, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func3default(A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
"f: double\n"
"\n"
"func3default(A e, short arg3, Tuple hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
@ -185,35 +197,39 @@ check(A.func2static.__doc__,
"\n"
" func2static(e, arg2, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func2static(e, arg2, hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func2static(e, arg2, hello, f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"f: double\n"
"\n"
"func2static(e, arg2, hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
@ -221,35 +237,39 @@ check(A.func3static.__doc__,
"\n"
" func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func3static(A e, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"f: double\n"
"\n"
"func3static(A e, short arg2, Tuple hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
@ -268,8 +288,9 @@ if sys.version_info[0:2] > (2, 4):
"\n"
"A_variable_c_get(self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"Parameters\n"
"----------\n"
"self: A *\n"
"\n",
"A.variable_c"
)
@ -277,14 +298,15 @@ if sys.version_info[0:2] > (2, 4):
"\n"
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"Parameters\n"
"----------\n"
"self: A *\n"
"\n",
"A.variable_d"
)
check(B.__doc__,
"Proxy of C++ B class",
"Proxy of C++ B class.",
"::B"
)
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip)
@ -294,10 +316,11 @@ check(E.__init__.__doc__,
"\n"
" __init__(self, a, b, h) -> E\n"
"\n"
" Parameters:\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
" Parameters\n"
" ----------\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
"\n"
" ", None, skip
)
@ -305,10 +328,11 @@ check(F.__init__.__doc__,
"\n"
" __init__(F self, int a, int b, Hola h) -> F\n"
"\n"
" Parameters:\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
" Parameters\n"
" ----------\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
"\n"
" ", None, skip
)