Solaar/lib/hidapi
mulhern d75b6d2f2b Fix some bugs in udev.get_indexed_string.
* from_device_number raises an exception if no device found, rather than
returning None. So, instead of checking the result, catch the exception.
* Use Attributes.get() method instead of checking containment and using the
index operator. This is really the only correct way, see rhbz#1267584.

Effect of the changes:
Previously, if no device was found this method would raise an exception.
Now it returns None instead.
Previously this method read the value of the attribute corresponding to key
twice, once via 'key in attributes' and again when accessing the key.
Now, it just reads it the one time.

Reason for noticing all these problems:
In pyudev-0.18 the Attributes class is fixed, and no longer has the []
operator or __contains__ method or other methods which require a total
mapping. This patch fixes several bugs while simultaneously avoiding these
removed operators.

Signed-off-by: mulhern <amulhern@redhat.com>
2015-12-23 09:22:48 -05:00
..
__init__.py added copyright notices to all source files 2013-07-15 17:54:42 +02:00
hidconsole.py added copyright notices to all source files 2013-07-15 17:54:42 +02:00
udev.py Fix some bugs in udev.get_indexed_string. 2015-12-23 09:22:48 -05:00