Jun-12-2024, 10:22 PM
(This post was last modified: Jun-12-2024, 10:22 PM by deanhystad.)
I have two graphics widgets, say a check button and a combo box. When I change the values in these controls, I want to call a function. Even though the controls are different types, the function is the same.
not actual code
I could write separate callback functions for the checkbox and the combobox, and have those call my function, but that is extra code to maintain
Any suggestion on how to make a tool like ruff happy? I try to avoid using # noqa.
not actual code
check = checkbox() check.value_changed_signal.connect(function) cbox = combobox() cbox.value_changed_signal.connect(function) def function(*_) -> None: """I don't use the event. I don't care if there is an event"" # do something important when the checkbox or combobox value changes.Static analysis tools complain that I am missing type information for *_ (ANN002). If I only had a checkbox I would write the function like this:
def function(event: checkbox_change_event) -> None:If I only had the combobox I would do something similar, but with a different event type. In both cases I would ignore the event and the analysis software would complain about that too!
I could write separate callback functions for the checkbox and the combobox, and have those call my function, but that is extra code to maintain
Any suggestion on how to make a tool like ruff happy? I try to avoid using # noqa.