def test_load(self, mock_load_utf_text_file, mock_loads): res = load('filename') self.assertEqual(res, 'loads_return_value') mock_loads.assert_called_with('{k:0}') mock_load_utf_text_file.assert_called_with( 'filename', default_encoding='UTF-8', use_utf8_strings=True, )
def merge_plugin_configs(plugins): global _c _c = {} for plugin in plugins: config_file = os.path.join(plugin.folder, 'config.json') if os.path.exists(config_file): print 'merging: ',config_file, plugin.id _merge_config(config_file, plugin.id) #override with more important settings if os.path.exists('config.json'): extend(_c, jsoncfg.load('config.json'))
def _merge_config(config_file, plugin_id): c = jsoncfg.load(config_file) extend(_c, { plugin_id : c })
return CaleydoConfigSection(self._expand(section)) _c = {} def _merge_config(config_file, plugin_id): c = jsoncfg.load(config_file) extend(_c, { plugin_id : c }) _own_config = os.path.dirname(os.path.abspath(__file__)) + '/config.json' if os.path.exists(_own_config): _merge_config(_own_config, 'caleydo_server') _web_config = os.path.dirname(os.path.abspath(__file__)) + '/../caleydo_core/config.json' if os.path.exists(_web_config): _merge_config(_web_config, 'caleydo_core') if os.path.exists('config.json'): extend(_c, jsoncfg.load('config.json')) def merge_plugin_configs(plugins): global _c _c = {} for plugin in plugins: config_file = os.path.join(plugin.folder, 'config.json') if os.path.exists(config_file): print 'merging: ',config_file, plugin.id _merge_config(config_file, plugin.id) #override with more important settings if os.path.exists('config.json'): extend(_c, jsoncfg.load('config.json'))
def vParseFile(self, srcFile): cfg = jsoncfg.load(srcFile.path) for asset in cfg[self.assetKey]: srcFile.appendAsset(asset[self.key], asset)
def get_hbuild_environment(self): """读取Hbuild项目的manifest.json文件""" manifest_path = os.path.join(self.hbuild_project_path, 'manifest.json') _json = jsoncfg.load(manifest_path) return _json
def load_build_config(): config = jsoncfg.load(os.path.join(CURRENT_PATH, 'config.json')) return config
def get_android_h5plussdk_json(self): h5_sdk_json = jsoncfg.load( os.path.join(CURRENT_PATH, '5+sdk_android.json')) return h5_sdk_json
def __init__(self, milleniumFalconJsonFile): self.milleniumFalconJson = jsoncfg.load(milleniumFalconJsonFile) self.autonomy = self.milleniumFalconJson['autonomy'] self.paths = C3PO.generatePaths(self)
def __init__(self, empireJsonFile): self.json = jsoncfg.load(empireJsonFile) self.paths = Empire.grabEmpirePath(self.json) self.countdown = self.json['countdown']