Skip to content
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

urls in the See Also section result in a ParseError #28

Open
keewis opened this issue Jan 16, 2022 · 0 comments
Open

urls in the See Also section result in a ParseError #28

keewis opened this issue Jan 16, 2022 · 0 comments

Comments

@keewis
Copy link
Collaborator

keewis commented Jan 16, 2022

If I put a url into the See Also section, I get a raw numpydoc.docscrape.ParseError:

def f(a):
    """Test function

    Parameters
    ----------
    a : int
        The first parameter.

    See Also
    --------
    https://numpydoc.readthedocs.io/en/latest/format.html#see-also
    """
    return a
Traceback
something went wrong with test.py:f :


    Test function.

    Parameters
    ----------
    a : int
        The first parameter.

    See Also
    --------
    https://numpydoc.readthedocs.io/en/latest/format.html#see-also
    
Traceback (most recent call last):
  File ".../lib/python3.9/site-packages/velin/ref.py", line 709, in compute_new_doc
    doc = NumpyDocString(dedend_docstring(docstr))
  File ".../lib/python3.9/site-packages/velin/ref.py", line 245, in __init__
    super().__init__(*args, **kwargs)
  File ".../lib/python3.9/site-packages/numpydoc/docscrape.py", line 147, in __init__
    self._parse()
  File ".../lib/python3.9/site-packages/numpydoc/docscrape.py", line 402, in _parse
    self['See Also'] = self._parse_see_also(content)
  File ".../lib/python3.9/site-packages/numpydoc/docscrape.py", line 324, in _parse_see_also
    raise ParseError("%s is not a item name" % line)
numpydoc.docscrape.ParseError: https://numpydoc.readthedocs.io/en/latest/format.html#see-also is not a item name in '\nTest function.\n\nParameters\n----------\na : int\n    The first parameter.\n\nSee Also\n--------\nhttps://numpydoc.readthedocs.io/en/latest/format.html#see-also\n'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ".../bin/velin", line 8, in <module>
    sys.exit(main())
  File ".../lib/python3.9/site-packages/velin/ref.py", line 1074, in main
    new, _fail_check = _reformat_file(
  File ".../lib/python3.9/site-packages/velin/ref.py", line 842, in _reformat_file
    new_doc, d_, jump_to_loc, _fail_check = compute_new_doc(
  File ".../lib/python3.9/site-packages/velin/ref.py", line 711, in compute_new_doc
    raise type(e)(f"error in {fname}:{func_name}") from e
numpydoc.docscrape.ParseError: error in test.py:f

This is probably not the right way to link to external resources, but even in that case I wouldn't expect to see a stacktrace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant