Skip to content

Wrong typing on evdev.categorize #239

@bastian-wattro

Description

@bastian-wattro

As of v1.9.1 categorize (

def categorize(event: InputEvent) -> InputEvent:
)
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions