示例#1
0
    def _retrieve_stored_settings(self):
        loaded_settings = {}
        for file in self.settings_files():
            settings_file = os.path.join(self.component_root_path(), file)

            if os.path.isfile(settings_file):
                with open(settings_file, 'r') as f:
                    merge_dicts(loaded_settings, yaml.safe_load(f))
        return loaded_settings
示例#2
0
 def test_merge(self):
     a = {'a': 4}
     b = {'b': 5}
     merge_dicts(a, b)
     self.assertEqual(a, {
         'a': 4,
         'b': 5
     })
     self.assertEqual(b, {'b': 5})
示例#3
0
 def test_merge8(self):
     a = {'a': 4, 'b': {}}
     b = {
         'a': 6,
         'b': {'c': 10}
     }
     merge_dicts(a, b)
     self.assertEqual(a, {
         'a': 6,
         'b': {'c': 10}
     })
示例#4
0
 def test_merge5(self):
     a = {'a': 4}
     b = {
         'a': 6,
         'b': {'c': 4}
     }
     merge_dicts(a, b)
     self.assertEqual(a, {
         'a': 6,
         'b': {'c': 4}
     })
示例#5
0
 def test_merge3(self):
     a = {'a': 4}
     b = OrderedDict([
         ('a', 6),
         ('b', 5)
     ])
     merge_dicts(a, b)
     self.assertEqual(a, {
         'a': 6,
         'b': 5
     })
示例#6
0
    def load_settings(self):
        loaded_settings = self._retrieve_stored_settings()

        merge_dicts(self.component_config.to_dict(), loaded_settings)