ITADN

Wrong typing on evdev.categorize

#239Closedbastian-wattro 创建于 2025-02-27
B
bastian-wattrocommented
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 条评论