Commit df5e0c4e authored by Peter Grayson's avatar Peter Grayson
Browse files

fix: silence ruff PLW1641 and mypy attr-defined in events.py

PLW1641 flags `ConditionValue`, which defines `__eq__` but no
`__hash__`; the class holds mutable state and is intentionally
unhashable, so make that explicit with `__hash__ = None`.

Mypy 2.x rejects `self._generator.gi_frame` because typeshed only
exposes `gi_frame` on the concrete generator type, but the value here is
always a real generator object, so silence the false positive with a
narrow type suppression.
parent f37411ae
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ class Process(Event):
                    raise

                msg = f'Invalid yield value "{event}"'
                descr = _describe_frame(self._generator.gi_frame)
                descr = _describe_frame(self._generator.gi_frame)  # type: ignore[attr-defined]
                raise RuntimeError(f'\n{descr}{msg}') from None

        self._target = event
@@ -473,6 +473,8 @@ class ConditionValue:
        else:
            return NotImplemented

    __hash__ = None  # type: ignore[assignment]

    def __repr__(self) -> str:
        return f'<ConditionValue {self.todict()}>'