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
griffe complains with No type or annotation for yielded value 1 when using Yields: together with properties.
Both removing @property or changing Yields: to Returns: works but results in different code or rendered docs.
To Reproduce
@propertydefchildren(self) ->Iterator[EnumValue]:
""" Yields: Direct children of this node. """yieldfromself._values
where
_values: List[EnumValue]
Full traceback
Relevant info:
WARNING - griffe: wake/ir/declarations/contract_definition.py:357: No type or annotation for yielded value 1WARNING - griffe: wake/ir/declarations/enum_definition.py:109: No type or annotation for yielded value 1WARNING - griffe: wake/ir/declarations/error_definition.py:94: No type or annotation for yielded value 1...
It's actually the first time (I think) that I encounter a property that is also a generator 😄 Mind blown a bit!
I suppose the issue comes from the fact that when we parse a Yields section, we expect the parent to be a function and not an attribute. It should be easy to fix 🙂
Description of the bug
griffe complains with
No type or annotation for yielded value 1
when usingYields:
together with properties.Both removing
@property
or changingYields:
toReturns:
works but results in different code or rendered docs.To Reproduce
where
Full traceback
Relevant info:
Full log from
mkdocs build -v
:log.txt
Expected behavior
griffe works with properties yielding values as expected.
Environment information
griffe --debug-info - __System__: macOS-14.5-arm64-arm-64bit - __Python__: cpython 3.12.2 (/Users/michal/.pyenv/versions/3.12.2/bin/python3.12) - __Environment variables__: - __Installed packages__: - `griffe` v0.47.0
The text was updated successfully, but these errors were encountered: