edk2toollib/uefi/edk2/variable_policy.py
def decode(self, buffer):
        """
        load this object from a bytes buffer

        return any remaining buffer
        """
        (_namespace, self.Value, _) = struct.unpack(
            self._HdrStructFormat, buffer[:self._HdrStructSize])

        self.Namespace = uuid.UUID(bytes_le=_namespace)

        # Scan the rest of the buffer for a \x00\x00 to terminate the string.
        buffer = buffer[self._HdrStructSize:]
        if len(buffer) < 4:
            raise ValueError("Buffer too short!")

        string_end = None
        for i in range(0, len(buffer), 2):
            if buffer[i] == 0 and buffer[i + 1] == 0:
                string_end = i + 2
                break

        if string_end is None:
            raise ValueError("String end not detected!")

        self.Name = buffer[:string_end].decode('utf-16').strip('\x00')

        return buffer[string_end:]

        load this object from a bytes buffer

        return any remaining buffer
        
load this object from a bytes buffer
return any remaining buffer
load this object from a bytes buffer return any remaining buffer
def decode(self, buffer):
        (_namespace, self.Value, _) = struct.unpack(
            self._HdrStructFormat, buffer[:self._HdrStructSize])
        self.Namespace = uuid.UUID(bytes_le=_namespace)
        buffer = buffer[self._HdrStructSize:]
        if len(buffer) < 4:
            raise ValueError("Buffer too short!")
        string_end = None
        for i in range(0, len(buffer), 2):
            if buffer[i] == 0 and buffer[i + 1] == 0:
                string_end = i + 2
                break
        if string_end is None:
            raise ValueError("String end not detected!")
        self.Name = buffer[:string_end].decode('utf-16').strip('\x00')
        return buffer[string_end:]
def decode ( self , buffer ) : ( _namespace , self . Value , _ ) = struct . unpack ( self . _HdrStructFormat , buffer [ : self . _HdrStructSize ] ) self . Namespace = uuid . UUID ( bytes_le = _namespace ) buffer = buffer [ self . _HdrStructSize : ] if len ( buffer ) < 4 : raise ValueError ( "Buffer too short!" ) string_end = None for i in range ( 0 , len ( buffer ) , 2 ) : if buffer [ i ] == 0 and buffer [ i + 1 ] == 0 : string_end = i + 2 break if string_end is None : raise ValueError ( "String end not detected!" ) self . Name = buffer [ : string_end ] . decode ( 'utf-16' ) . strip ( '\x00' ) return buffer [ string_end : ]
load this object from a bytes buffer
return any remaining buffer
load this object from a bytes buffer return any remaining buffer
"""
        load this object from a bytes buffer

        return any remaining buffer
        """ # Scan the rest of the buffer for a \x00\x00 to terminate the string.
self
buffer