We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When using Griffe as a docstring-parsing library according to https://mkdocstrings.github.io/griffe/usage/#using-griffe-as-a-docstring-parsing-library , we sometimes get ValueError at
ValueError
https://github.com/mkdocstrings/griffe/blob/master/src/griffe/dataclasses.py#L497
... which is caused by the warning method
warning
https://github.com/mkdocstrings/griffe/blob/master/src/griffe/docstrings/utils.py#L37
... which is called from
https://github.com/mkdocstrings/griffe/blob/master/src/griffe/docstrings/google.py#L189
... when an annotation is missing.
To Reproduce
Run this:
from griffe.dataclasses import Docstring, Function, Parameters, Parameter from griffe.docstrings.google import parse if __name__ == "__main__": parsed_docstring = parse( Docstring( value="""\ A function. Args: a: Whatever Returns: Nothing. """, lineno=1, parent=Function( name="foo", parameters=Parameters( Parameter( name="a", annotation=None, default="5", ) ), ), ) )
Expected behavior No error, just the usual warning. The warning need not contain the file path if there is no file path.
System (please complete the following information):
griffe
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Another example, from the docs, but without annotation:
from griffe.dataclasses import Docstring, Function, Parameters, Parameter, ParameterKind from griffe.docstrings.parsers import Parser, parse function = Function( "func", parameters=Parameters( Parameter("param1", annotation=None, kind=ParameterKind.positional_or_keyword), # I only changed this line Parameter("param2", annotation="int", kind=ParameterKind.keyword_only), ), ) text = """ Hello I'm a docstring! Parameters: param1: Description. param2: Description. """ docstring = Docstring(text, lineno=1, parent=function) parsed = parse(docstring, Parser.google)
Sorry, something went wrong.
fix: Fix docstrings warnings when there's no parent module
e080549
Issue #51: #51
Thanks for the report! This is fixed in master (will push and release soon).
No branches or pull requests
Describe the bug
When using Griffe as a docstring-parsing library according to https://mkdocstrings.github.io/griffe/usage/#using-griffe-as-a-docstring-parsing-library , we sometimes get
ValueError
athttps://github.com/mkdocstrings/griffe/blob/master/src/griffe/dataclasses.py#L497
... which is caused by the
warning
methodhttps://github.com/mkdocstrings/griffe/blob/master/src/griffe/docstrings/utils.py#L37
... which is called from
https://github.com/mkdocstrings/griffe/blob/master/src/griffe/docstrings/google.py#L189
... when an annotation is missing.
To Reproduce
Run this:
Expected behavior
No error, just the usual warning. The warning need not contain the file path if there is no file path.
System (please complete the following information):
griffe
version: 0.13.0Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: