CircuitPython version
Code/REPL
my_group = displayio.Group()
# ... append some things ...
for item in my_group:
print(item)
Behavior
mypy flags an error on code like this indicating that a value is unsupported for use in the right operand of the in operator:
error: Unsupported right operand type for in ("GridLayout") [operator]
In this case GridLayout is extending Group. It flags the same issue whether its a subclass or the root class Group.
Description
No response
Additional information
Adding this in the stubs definition makes it so that mypy does not flag this as an error:
//| def __contains__(
//| self, item: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]
//| ) -> bool: ...
I'll submit a PR with that addition to the comments that stubs come from. I tested locally by building stubs and installing with pip install .
CircuitPython version
AllCode/REPL
Behavior
mypy flags an error on code like this indicating that a value is unsupported for use in the right operand of the in operator:
In this case GridLayout is extending Group. It flags the same issue whether its a subclass or the root class Group.
Description
No response
Additional information
Adding this in the stubs definition makes it so that mypy does not flag this as an error:
I'll submit a PR with that addition to the comments that stubs come from. I tested locally by building stubs and installing with
pip install .