コード例 #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 プロジェクト: LightBitsLabs/inaugurator
    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
ファイル: device.py プロジェクト: LightBitsLabs/inaugurator
 def __contains__(self, attribute):
     value = libudev.udev_device_get_sysattr_value(
         self.device, ensure_byte_string(attribute))
     return value is not None
コード例 #4
0
 def __contains__(self, attribute):
     value = libudev.udev_device_get_sysattr_value(
         self.device, ensure_byte_string(attribute))
     return value is not None