python-dbus-next
python-dbus-next copied to clipboard
signal handlers: check for number of arguments gets fooled by **kwargs handler
I am trying to register one generic handler to a couple of DBus signals with different signatures. This should be not a big deal in the world of duck typing - just use **kwargs in your handler and see what number of args you get.
Unfortunately, dbus-next is stopping me here: https://github.com/altdesktop/python-dbus-next/blob/04e7c0428ec2e4020d4b95aa70e10feb8e53e22e/dbus_next/proxy_object.py#L105
This check comes to the conclusion that my handler has one argument (**kwargs), but my signal has two.
Is there any chance to improve this check, opt out of it or remove it completely? I think this static understanding of the number of arguments is not very Pythonic.
A keyword argument needs a keyword for naming, where would you expect them to come from ?
Correct, my mistake. However, *args would probably trigger exactly the same problem.
I think I can remove that check.
A keyword argument needs a keyword for naming, where would you expect them to come from
From DBus introspection information?
Currently thinking about implementig that way - would be extremely helpful for my usecase (a single subscriber monitors a bunch of signals). Has anybody tried that before and is there a reason against that I should be aware?