You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classArgsKwargs:
""" Wrapper for combined positional and keyword arguments, as passed to a function. """def__init__(self, args: 'tuple[Any, ...]', kwargs: 'dict[str, Any] | None'=None) ->None:
""" Args: args: positional arguments kwargs: keyword arguments """@propertydefargs(self) ->'tuple[Any, ...]':
""" positional arguments """@propertydefkwargs(self) ->'dict[str, Any] | None':
""" keyword arguments """
Gives me the error:
ERROR - Error reading page 'api/pydantic_core_init.md': Cannot parse: 1:24: args: tuple[Any, ...] = <attribute 'args' of
'pydantic_core._pydantic_core.ArgsKwargs' objects>
Traceback (most recent call last):
File "/home/samuel/code/pydantic/env310/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocs/__main__.py", line 234, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 83, in serve
builder(config)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 76, in builder
build(config, live_server=live_server, dirty=dirty)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocs/commands/build.py", line 308, in build
_populate_page(file.page, config, files, dirty)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocs/commands/build.py", line 181, in _populate_page
page.render(config, files)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocs/structure/pages.py", line 270, in render
self.content = md.convert(self.markdown)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/markdown/core.py", line 264, in convert
root = self.parser.parseDocument(self.lines).getroot()
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/markdown/blockparser.py", line 90, in parseDocument
self.parseChunk(self.root, '\n'.join(lines))
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/markdown/blockparser.py", line 105, in parseChunk
self.parseBlocks(parent, text.split('\n\n'))
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/markdown/blockparser.py", line 123, in parseBlocks
if processor.run(parent, blocks) is not False:
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings/extension.py", line 127, in run
html, handler, data = self._process_block(identifier, block, heading_level)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings/extension.py", line 213, in _process_block
rendered = handler.render(data, options)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/handler.py", line 322, in render
return template.render(
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/templates/material/class.html", line 1, in top-level template code
{% extends "_base/class.html" %}
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/templates/material/_base/class.html", line 105, in top-level template code
{% include "children.html" with context %}
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/templates/material/children.html", line 1, in top-level template code
{% extends "_base/children.html" %}
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/templates/material/_base/children.html", line 30, in top-level template code
{% include "attribute.html" with context %}
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/templates/material/attribute.html", line 1, in top-level template code
{% extends "_base/attribute.html" %}
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/templates/material/_base/attribute.html", line 42, in top-level template code
{% filter format_code(config.line_length) %}
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/rendering.py", line 62, in do_format_code
return formatter(code, line_length)
File "/home/samuel/code/pydantic/env310/lib/python3.10/site-packages/mkdocstrings_handlers/python/rendering.py", line 248, in formatter
return format_str(code, mode=mode)
File "src/black/__init__.py", line 1079, in format_str
File "src/black/__init__.py", line 1089, in _format_str_once
File "src/black/parsing.py", line 127, in lib2to3_parse
black.parsing.InvalidInput: Cannot parse: 1:24: args: tuple[Any, ...] = <attribute 'args' of 'pydantic_core._pydantic_core.ArgsKwargs' objects
Quick workaround: add from __future__ import annotations at the top of your stub, and remove quotes around type annotations. Griffe currently only supports single names in quote-wrapped annotations. Supporting complex annotations will require to parse again the value of the string. Should be easy enough 🙂
Describe the bug
Error parsing the following code in a
.pyi
file.Gives me the error:
To Reproduce
I got this while trying to continue pydantic/pydantic#5695.
I wasn't seeing any docs, so I added some docstrings to the
env310/lib/python3.10/site-packages/pydantic_core/_pydantic_core.pyi
and got this error.The text was updated successfully, but these errors were encountered: