Process results_database parameters in config to format them for
    set database function

    :param dict config: project configuration dict
    :param str output_dir: output directory for results
    :return: string for db uri
770316
def get_db_uri(config, output_dir):
    
    db_config = config.get("results_database", {"db_uri": "default"})
    if db_config['db_uri'] == 'default':
        return os.path.join(output_dir, "results.sqlite")
    return db_config['db_uri']
841292
def output_path
      Pathname.new File.join(Massimo.config.output_path, url.sub(/^#{Regexp.escape(Massimo.config.base_url)}/, ''))
    end
1087806
def get_result(db, result_id):
    
    job = db('SELECT job.*, ds_key FROM job, output WHERE '
             'oq_job_id=job.id AND output.id=?x', result_id, one=True)
    return (job.id, job.status, job.user_name,
            os.path.dirname(job.ds_calc_dir), job.ds_key)
368306
def get_runconfig(path=None, root=None, db=None):
    

    return load(path, root=root, db=db)
903202
def output(results_dir, config, parent='../../'):
    
    start = time.time()
    print("Compiling results...")
    results_dir = os.path.abspath(results_dir)
    results = ReportResults(config['run_time'], config['results_ts_interval'])
    results.compile_results()
    print("Results compiled in {} seconds\n".format(time.time() - start))

    if results.total_transactions == 0:
        print("No results, cannot create report")
        return False

    print_infos(results)

    data = {
        'report': results,
        'run_time': config['run_time'],
        'ts_interval': config['results_ts_interval'],
        'turrets_config': results.turrets,
        'results': {"all": results.main_results, "timers": results.timers_results}
    }

    print("Generating graphs...")
    partial = time.time()
    generate_graphs(results.main_results, 'All_Transactions', results_dir)

    for key, value in results.timers_results.items():
        generate_graphs(value, key, results_dir)
    print("All graphs generated in {} seconds\n".format(time.time() - partial))

    write_template(data, results_dir, parent)
    print("Full report generated in {} seconds".format(time.time() - start))
    return True
32671
function outputRequireConfigInfo(packedFiles, context, parseOpts, settings) {
    var resMaps = getOutputResourcePathMap(packedFiles, context, parseOpts, settings);
    resMaps.forEach(function(item) {
        var page = item.file;
        var config = context.getRequireConfig(item.paths, settings.amdConfig);
        var script;

        if (settings.inlineResourceConfig) {
            script = _.createRequireConfigScript(config);
        } else {
            var configFile = page.subpathNoExt + '_config.js';
            if (_.isFunction(settings.resourceConfigFile)) {
                configFile = settings.resourceConfigFile(configFile, page);
            }
            configFile = context.createFile(
                configFile,
                _.getRequireConfigScript(config)
            );
            if (context.isFileExisted(configFile)) {
                fis.log.error('output resource config file is exists: %s', configFile.id);
            }

            context.addFile(configFile);
            script = htmlParser.createScriptTags(page, configFile);
        }
        var content = page.getContent().replace(
            parseOpts.resourceConfigPlaceholder, '\n'+script
        );
        page.setContent(content);
    });
}
987749
def parse_config_output(self, output):
        
        regexp = re.compile('^(config |edit |set |end$|next$)(.*)')
        current_block = self

        if isinstance(output, py23_compat.string_types):
            output = output.splitlines()

        for line in output:
            if 'uuid' in line:
                continue
            if 'snmp-index' in line:
                continue
            line = line.strip()
            result = regexp.match(line)

            if result is not None:
                action = result.group(1).strip()
                data = result.group(2).strip()

                if action == 'config' or action == 'edit':
                    data = data.replace('"', '')
                    if data not in current_block.get_block_names():
                        config_block = FortiConfig(data, action, current_block)
                        current_block[data] = config_block
                    else:
                        config_block = current_block[data]
                    current_block = config_block
                elif action == 'end' or action == 'next':
                    current_block = current_block.get_parent()
                elif action == 'set':
                    split_data = data.split(' ')
                    parameter = split_data[0]
                    data = split_data[1:]
                    current_block.set_param(parameter, ' '.join(data))
792390
def config(name='DATABASE_URL', default='sqlite://:memory:'):
    """"""
    config = {}
    s = env(name, default)
    if s:
        config = parse_database_url(s)
    return config
1218966
def find_config(directory_or_file, debug=False):
    
    directory_or_file = os.path.realpath(directory_or_file)
    if os.path.isfile(directory_or_file):
        if debug:
            print('using config file {}'.format(directory_or_file),
                  file=sys.stderr)
        return directory_or_file
    directory = directory_or_file

    while directory:
        for filename in CONFIG_FILES:
            candidate = os.path.join(directory, filename)
            if os.path.exists(candidate):
                if debug:
                    print('using config file {}'.format(candidate),
                          file=sys.stderr)
                return candidate

        parent_directory = os.path.dirname(directory)
        if parent_directory == directory:
            break
        else:
            directory = parent_directory
310769
def _get_result_paths(self, data):
        
        assignment_fp = str(self.Parameters['-o'].Value).strip('"')
        if not os.path.isabs(assignment_fp):
            assignment_fp = os.path.relpath(assignment_fp, self.WorkingDir)
        return {'Assignments': ResultPath(assignment_fp, IsWritten=True)}
1168471
def _default_output_dir():
  """"""
  try:
    dataset_name = gin.query_parameter("inputs.dataset_name")
  except ValueError:
    dataset_name = "random"
  dir_name = "{model_name}_{dataset_name}_{timestamp}".format(
      model_name=gin.query_parameter("train.model").configurable.name,
      dataset_name=dataset_name,
      timestamp=datetime.datetime.now().strftime("%Y%m%d_%H%M"),
  )
  dir_path = os.path.join("~", "trax", dir_name)
  print()
  trax.log("No --output_dir specified")
  return dir_path
704325
def output_dir(self, *args) -> str:
        
        return os.path.join(self.project_dir, 'output', *args)
325688
def _get_result_paths(self,data):
        
        output_dir = self.Parameters['--out-dir'].Value
        result = {}
        result['json'] = ResultPath(Path=join(output_dir,
                                splitext(split(self._input_filename)[-1])[0] + \
                                '.jplace'))
        return result
1183494
def dump(self, conf_file=None):
        

        if conf_file:
            conf_dir = os.path.dirname(conf_file)
            if not conf_dir:
                conf_dir = self.__invoke_dir
            elif not os.path.exists(conf_dir):
                os.makedirs(conf_dir)
        else:
            conf_dir = self.__conf_dir

        final_conf = {}
        for key, value in list(self.__config.items()):
            if key in self.__cli:
                continue
            final_conf[key] = value

        for key, value in list(self.__cli.items()):
            if key.endswith('index') or key in ['sitemap', 'output']:
                path = self.__abspath(value, from_conf=False)
                if path:
                    relpath = os.path.relpath(path, conf_dir)
                    final_conf[key] = relpath
            elif key.endswith('sources') or key.endswith('source_filters'):
                new_list = []
                for path in value:
                    path = self.__abspath(path, from_conf=False)
                    if path:
                        relpath = os.path.relpath(path, conf_dir)
                        new_list.append(relpath)
                final_conf[key] = new_list
            elif key not in ['command', 'output_conf_file']:
                final_conf[key] = value

        with open(conf_file or self.conf_file or 'hotdoc.json', 'w') as _:
            _.write(json.dumps(final_conf, sort_keys=True, indent=4))
752807
function _result(err, dbName, docId, message) {
    var result = {
      id: util.format('%s%s%s', dbName, (docId) ? '/' : '', docId || ''),
      message: message || util.format('%s (%s)', err.error, err.status_code)
    };
    if (err) {
      result.error = err;
    }
    return result;
  }
1274639
def _generate_output_dir(settings, path):
        

        relpath = os.path.relpath(settings.root,path)
        count = relpath.count(os.sep) + 1

        return relpath+os.path.sep, count
1031614
def handle_config(args):
    
    session_file = get_db_name(args['<session-file>'])
    with use_db(session_file) as database:
        config = database.get_config()
        print(serialize_config(config))

    return ExitCode.OK