Skip to content

Failed See Also Parsing. #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Carreau opened this issue Jul 14, 2020 · 0 comments · Fixed by #283
Closed

Failed See Also Parsing. #281

Carreau opened this issue Jul 14, 2020 · 0 comments · Fixed by #283

Comments

@Carreau
Copy link
Contributor

Carreau commented Jul 14, 2020

In [1]: from numpydoc.docscrape import NumpyDocString
   ...: from numpy import seterrobj
   ...: NumpyDocString("""seterrobj(errobj)
   ...:
   ...:     Set the object that defines floating-point error handling.
   ...:
   ...:     See Also
   ...:     --------
   ...:     geterrobj, seterr, geterr, seterrcall, geterrcall
   ...:     getbufsize, setbufsize""")['See Also']
Out[1]: []

In [2]:
diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py
index 77de401..d79992c 100644
--- a/numpydoc/docscrape.py
+++ b/numpydoc/docscrape.py
@@ -284,6 +284,8 @@ class NumpyDocString(Mapping):

         """

+        content = dedent_lines(content)
         items = []

         def parse_item_name(text):

Might be enough, but it may also be the wrong place to put that:

In [1]: from numpydoc.docscrape import NumpyDocString
   ...: from numpy import seterrobj
   ...: NumpyDocString("""seterrobj(errobj)
   ...:
   ...:     Set the object that defines floating-point error handling.
   ...:
   ...:     See Also
   ...:     --------
   ...:     geterrobj, seterr, geterr, seterrcall, geterrcall
   ...:     getbufsize, setbufsize""")['See Also']
Out[1]:
[([('geterrobj', None),
   ('seterr', None),
   ('geterr', None),
   ('seterrcall', None),
   ('geterrcall', None)],
  []),
 ([('getbufsize', None), ('setbufsize', None)], [])]
Carreau added a commit to Carreau/numpydoc that referenced this issue Jul 15, 2020
…line.

in a case like:

"""signature

See Also
--------
a,b,c,d

""""

Numpydoc would incorrectly assign `a, b, c, d` as a description with no
name, or type associated items.

Closes numpy#281
Carreau added a commit to Carreau/numpydoc that referenced this issue Jul 15, 2020
in a case like:

"""signature

See Also
--------
a,b,c,d

""""

Numpydoc would incorrectly assign `a, b, c, d` as a description with no
name, or type associated items.

Closes numpy#281
Carreau added a commit to Carreau/numpydoc that referenced this issue Jul 15, 2020
in a case like:

"""signature

See Also
--------
a,b,c,d

""""

Numpydoc would incorrectly assign `a, b, c, d` as a description with no
name, or type associated items.

Closes numpy#281
larsoner pushed a commit that referenced this issue Jul 16, 2020
in a case like:

"""signature

See Also
--------
a,b,c,d

""""

Numpydoc would incorrectly assign `a, b, c, d` as a description with no
name, or type associated items.

Closes #281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant