Wrong typing on evdev.categorize
As of v1.9.1 `categorize` ( https://github.com/gvalkov/python-evdev/blob/82d09f631a16329c6d3ca2a2fd3789fac3a01c4b/src/evdev/util.py#L35 )
is typed to return `InputEvent` which is correct if it cannot be categorized but wrong in all other cases.
A quick fix would be to change the return value to `InputEvent | KeyEvent | RelEvent | AbsEvent | SynEvent`.
There are probably more involved solutions that help tools like mypy to narrow down the value correctly.
I would be willing to set up a PR if this is wanted.
关闭于 2025-02-28 1 条评论