(self, device_params)
return output_dict
Normalise keys in device parameter dict.
Normalise keys in device parameter dict.
Normalise keys in device parameter dict .
def _normalise_params(self, device_params):
        """Normalise keys in device parameter dict."""
        if not device_params:
            return {}
        output_dict = {}
        for key, value in iteritems(device_params):
            key = self._normalise_device_name(key)
            if not key:
                continue
            # convert value to unicode
            if isinstance(value, bytes):
                try:
                    value = value.decode('ascii')
                except UnicodeError:
                    logging.error(
                        'Invalid device parameter value: `%s` must be ascii if given as bytes.', key
                    )
                    continue
            output_dict[key] = value
        return output_dict
def _normalise_params ( self , device_params ) : if not device_params : return { } output_dict = { } for key , value in iteritems ( device_params ) : key = self . _normalise_device_name ( key ) if not key : continue # convert value to unicode if isinstance ( value , bytes ) : try : value = value . decode ( 'ascii' ) except UnicodeError : logging . error ( 'Invalid device parameter value: `%s` must be ascii if given as bytes.' , key ) continue output_dict [ key ] = value return output_dict