def test_update_subset(self): base_dict = {1: 2, 2: 45, 4: 4} update_dict = {1: 3, 2: 43} dict_strict_update(base_dict, update_dict) self.assertEqual(base_dict, {1: 3, 2: 43, 4: 4})
def _get_final_transition_handlers(self, overrides): transitions = self._get_transition_handlers() if overrides is not None: dict_strict_update(transitions, overrides) return transitions
def _get_final_state_handlers(self, overrides): states = self._get_state_handlers() if overrides is not None: dict_strict_update(states, overrides) return states
def test_update_subset(self): base_dict = {1: 2, 2: 45, 4: 4} update_dict = {1: 3, 2: 43} dict_strict_update(base_dict, update_dict) self.assertEqual(base_dict, {1: 3, 2: 43, 4: 4})
def __init__(self, options=None): super(Adapter, self).__init__() self._interface = None self.device_lock = NoLock() options = options or {} combined_options = dict(self.default_options) try: dict_strict_update(combined_options, options) except RuntimeError as e: raise LewisException( 'Invalid options found: {}. Valid options are: {}'.format( ', '.join(e.args[1]), ', '.join(self.default_options.keys()) )) options_type = namedtuple('adapter_options', list(combined_options.keys())) self._options = options_type(**combined_options)
def __init__(self, options=None): super(Adapter, self).__init__() self._interface = None self.device_lock = NoLock() options = options or {} combined_options = dict(self.default_options) try: dict_strict_update(combined_options, options) except RuntimeError as e: raise LewisException( "Invalid options found: {}. Valid options are: {}".format( ", ".join(e.args[1]), ", ".join(self.default_options.keys()))) options_type = namedtuple("adapter_options", list(combined_options.keys())) self._options = options_type(**combined_options)