示例#1
0
    def __getitem__(self, attribute):
        """
        Get the given system ``attribute`` for the device.

        ``attribute`` is a unicode or byte string containing the name of the
        system attribute.

        Return the attribute value as byte string, or raise a
        :exc:`~exceptions.KeyError`, if the given attribute is not defined
        for this device.
        """
        value = libudev.udev_device_get_sysattr_value(
            self.device, ensure_byte_string(attribute))
        if value is None:
            raise KeyError(attribute)
        return value
示例#2
0
文件: device.py 项目: PSC-SR/robotpy
    def __getitem__(self, attribute):
        """
        Get the given system ``attribute`` for the device.

        ``attribute`` is a unicode or byte string containing the name of the
        system attribute.

        Return the attribute value as byte string, or raise a
        :exc:`~exceptions.KeyError`, if the given attribute is not defined
        for this device.
        """
        value = libudev.udev_device_get_sysattr_value(
            self.device, ensure_byte_string(attribute))
        if value is None:
            raise KeyError(attribute)
        return value
示例#3
0
 def __contains__(self, attribute):
     value = libudev.udev_device_get_sysattr_value(
         self.device, ensure_byte_string(attribute))
     return value is not None
示例#4
0
文件: device.py 项目: PSC-SR/robotpy
 def __contains__(self, attribute):
     value = libudev.udev_device_get_sysattr_value(
         self.device, ensure_byte_string(attribute))
     return value is not None