pyudev / pyudev

Python bindings to libudev (with support for PyQt4, PySide, pygobject and wx)
http://pyudev.readthedocs.org
GNU Lesser General Public License v2.1
166 stars 50 forks source link

Contradiction between docs and pyudev.glib.MonitorObserver #229

Open jmptbl opened 6 years ago

jmptbl commented 6 years ago

Documentation for pyudev.glib.MonitorObserver states:

This class emits the following GObject signal: device-event(observer, action, device)

Which corresponds to the old behaviour of pyudev.glib.GUDevMonitorObserver, however the code example for pyudev.glib.MonitorObserver implies device-event(observer, device):

>>> def device_event(observer, device):
...     print('event {0} on device {1}'.format(device.action, device))
>>> observer.connect('device-event', device_event)

Which is what corresponds to actual library implementation.

What should it be?

Moving from pyudev.glib.GUDevMonitorObserver to pyudev.glib.MonitorObserver one would expect the same device-event(observer, action, device) callback protocol, not a change to device-event(observer, device).

mulkieran commented 6 years ago

I've never used that code, didn't write it, and hope to remove it for pyudev v1.0 (see #120). It's really up to users to sort that kind of question out. If you find a correction to make to the docs, please go ahead and open a PR. If you want to know why that change was made I guess the best thing to do is examine the relevant issues and commit messages. You are in probably a better case to understand them than I, as you seem interested in actually using that functionality.