Read the _application.json_ files.

    Args:
        runway_dir (str): Name of runway directory with app.json files.

    Returns:
        collections.defaultdict: Configurations stored for each environment
        found.
552992
def process_runway_configs(runway_dir=''):
    
    LOG.info('Processing application.json files from local directory "%s".', runway_dir)
    file_lookup = FileLookup(runway_dir=runway_dir)
    app_configs = process_configs(file_lookup, 'application-master-{env}.json', 'pipeline.json')
    return app_configs
862197
def _read_routine_metadata(self):
        
        metadata = {}
        if os.path.isfile(self._metadata_filename):
            with open(self._metadata_filename, 'r') as file:
                metadata = json.load(file)

        return metadata
773879
def _read_json_file(self, json_file):
        

        self.log.debug("Reading '%s' JSON file..." % json_file)

        with open(json_file, 'r') as f:
            return json.load(f, object_pairs_hook=OrderedDict)
434289
def runway_config(self):
        """"""
        if not self._runway_config:
            self._runway_config = self.parse_runway_config()
        return self._runway_config
697580
def _jsonfileconstructor(self, filename=None, filepath=None, logger=None):
        
        if filepath:
            path = filepath
        else:
            tc_path = os.path.abspath(os.path.join(inspect.getfile(self.bench.__class__),
                                                   os.pardir))
            path = os.path.abspath(os.path.join(tc_path, os.pardir, "session_data"))
        name = "default_file.json" if not filename else filename
        log = self.bench.logger if not logger else logger
        self.bench.logger.info("Setting json file location to: {}".format(path))
        return files.JsonFile(log, path, name)
1329814
def _collect_settings(self, apps):
        
        contents = {}
        if apps:
            for app in apps:
                if app not in settings.INSTALLED_APPS:
                    raise CommandError("Application '{0}' not in settings.INSTALLED_APPS".format(app))
        else:
            apps = settings.INSTALLED_APPS
        for app in apps:
            module = import_module(app)
            for module_dir in module.__path__:
                json_file = os.path.abspath(os.path.join(module_dir, self.json_file))
                if os.path.isfile(json_file):
                    with open(json_file, 'r') as fp:
                        contents[app] = json.load(fp)
        return contents
666458
def _read_apps(self):
        
        apps = {}
        for cfgfile in glob.iglob(os.path.join(self.confdir, '*.conf')):
            name = os.path.basename(cfgfile)[0:-5]
            try:
                app = AppLogParser(name, cfgfile, self.args, self.logdir,
                                   self.fields, self.name_cache, self.report)
            except (LogRaptorOptionError, LogRaptorConfigError, LogFormatError) as err:
                logger.error('cannot add app %r: %s', name, err)
            else:
                apps[name] = app

        if not apps:
            raise LogRaptorConfigError('no configured application in %r!' % self.confdir)
        return apps
89478
def _get_main_and_json(directory):
    
    directory = os.path.normpath(os.path.abspath(directory))
    checker_main = os.path.normpath(os.path.join(directory, os.path.pardir, "checker-workflow-wrapping-tool.cwl"))
    if checker_main and os.path.exists(checker_main):
        main_cwl = [checker_main]
    else:
        main_cwl = glob.glob(os.path.join(directory, "main-*.cwl"))
        main_cwl = [x for x in main_cwl if not x.find("-pack") >= 0]
        assert len(main_cwl) == 1, "Did not find main CWL in %s" % directory
    main_json = glob.glob(os.path.join(directory, "main-*-samples.json"))
    assert len(main_json) == 1, "Did not find main json in %s" % directory
    project_name = os.path.basename(directory).split("-workflow")[0]
    return main_cwl[0], main_json[0], project_name
915033
def setDictionary(self, data):
		
		
		# Create the directory containing the JSON file if it doesn't already exist
		jsonDir = os.path.dirname(self.jsonFile)
		if os.path.exists(jsonDir) == False:
			os.makedirs(jsonDir)
		
		# Store the dictionary
		Utility.writeFile(self.jsonFile, json.dumps(data))
1244340
def cfg(self):
        
        config = LStruct(self.defaults)
        module = config['CONFIG'] = os.environ.get(
            CONFIGURATION_ENVIRON_VARIABLE, config['CONFIG'])

        if module:
            try:
                module = import_module(module)
                config.update({
                    name: getattr(module, name) for name in dir(module)
                    if name == name.upper() and not name.startswith('_')
                })

            except ImportError as exc:
                config.CONFIG = None
                self.logger.error("Error importing %s: %s", module, exc)

        # Patch configuration from ENV
        for name in config:
            if name.startswith('_') or name != name.upper() or name not in os.environ:
                continue
            try:
                config[name] = json.loads(os.environ[name])
            except ValueError:
                pass

        return config
711567
def load_json
      json_config_file = Utils.lookup_file @filenames[:json]

      config = Utils.load_json json_config_file
      config.empty? ? @default_config : @default_config.merge(config)
    end
467961
def load_conf(cfg_path):
    
    global config
    try:
        cfg = open(cfg_path, 'r')
    except Exception as ex:
        if verbose:
            print("Unable to open {0}".format(cfg_path))
            print(str(ex))
        return False

    # Read the entire contents of the conf file
    cfg_json = cfg.read()
    cfg.close()
    # print(cfg_json)

    # Try to parse the conf file into a Python structure
    try:
        config = json.loads(cfg_json)
    except Exception as ex:
        print("Unable to parse configuration file as JSON")
        print(str(ex))
        return False

    # This config was successfully loaded
    return True
68083
def load_json_fixture(fixture_path: str) -> Dict[str, Any]:
    
    with open(fixture_path) as fixture_file:
        file_fixtures = json.load(fixture_file)
    return file_fixtures
808633
def read_config_file(path):
    """"""
    try:
        with open(path, 'r') as f:
            return json.load(f, object_pairs_hook=OrderedDict)
    except IOError as ex:
        if ex != errno.ENOENT:
            raise
    return {}
781193
def load_application_info(path):
        
        with open(path + 'info.json', 'r') as infoFile:
            info = json.loads(infoFile.read())
        return info
1258049
def _get_config_dict_from_file(config_path=None):
    
    if config_path is None:
        config_path = DEFAULT_CONFIG_PATH

    # Default (empty) content will be used if config file does not exist.
    config_content = {}

    # If the config file exists we use that content.
    if os.path.isfile(config_path):
        with open(config_path) as fh:
            config_content = json.load(fh)

    return config_content
569786
def parser(input_file_path='config.json'):
    '''
    
    '''

    # --- Read .json file
    try:
        with open(input_file_path, 'r') as config_file:
            config_new = json.load(config_file)
            config_file.close()
    except:
        raise Exception('Config file "'+input_file_path+'" not loaded properly. Please check it an try again.')

    import copy
    options = update_config(config_new, copy.deepcopy(default_config))

    return options