dumps configfile to stdout so users can edit/implement their own
975220
def dump_config(self):  # pragma: no cover
        """"""
        with open(self.config_path, 'r') as cfg_fh:
            base_config = cfg_fh.read()

        print(base_config)
        exit(2)
532988
def configfile(f):
    

    @click.pass_context
    def new_func(ctx, *args, **kwargs):
        ctx.config = yaml.load(open(ctx.obj["configfile"]))
        return ctx.invoke(f, *args, **kwargs)

    return update_wrapper(new_func, f)
1070249
def main(cls, args=None):
        
        organizer = cls()
        organizer.parse_args(args)
        if not organizer.no_modification:
            organizer.config.save()
518103
def generate_config(directory):
    
    default_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.yml")
    target_config_path = os.path.abspath(os.path.join(directory, 'config.yml'))
    shutil.copy(default_config, target_config_path)
    six.print_("Config file has been generated in", target_config_path)
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))
590996
def dump_config(self):
        
        path = os.path.join(tempfile.gettempdir(),
                            'dump-cfg-scheduler-%s-%d.json' % (self.name, int(time.time())))

        try:
            self.pushed_conf.dump(path)
        except (OSError, IndexError) as exp:  # pragma: no cover, should never happen...
            logger.critical("Error when writing the configuration dump file %s: %s",
                            path, str(exp))
743835
def save config_file
      config_file ||= @config_file
      File.open(config_file, 'w') do |f|
        f.puts self.to_s
      end
    end
109404
def write_out_config(self, config_file):
        
        with open(config_file, 'w') as f:
            json.dump(self.params, f, indent=2,
                      separators=(',', ': '))
955659
def dump(config):
    

    return yaml.safe_dump(
        config.to_primitive(),
        default_flow_style=False,
        encoding='utf-8',
        allow_unicode=True)
267960
def generate_config(ctx):
    
    path = click.prompt('Please specify a location for the sample gitlint config file', default=DEFAULT_CONFIG_FILE)
    path = os.path.abspath(path)
    dir_name = os.path.dirname(path)
    if not os.path.exists(dir_name):
        click.echo(u"Error: Directory '{0}' does not exist.".format(dir_name), err=True)
        ctx.exit(USAGE_ERROR_CODE)
    elif os.path.exists(path):
        click.echo(u"Error: File \"{0}\" already exists.".format(path), err=True)
        ctx.exit(USAGE_ERROR_CODE)

    LintConfigGenerator.generate_config(path)
    click.echo(u"Successfully generated {0}".format(path))
    ctx.exit(0)
768541
def dump(self):
        """"""
        try:
            import yaml
            cfg_file = self._cfg_file()
            cfg_dir, __ = os.path.split(cfg_file)
            os.makedirs(cfg_dir, exist_ok=True)
            with open(cfg_file, 'w') as f:
                yaml.dump(self, f)
        except ImportError as err:
            raise RuntimeError(
                'Cannot dump the configuration settings to file. You need to '
                'install the necessary dependencies (pyyaml, appdirs).'
            ) from err
684794
def dump_config(self):
        

        conf = copy_config(self.config, self.mutable_config_keys)
        conf['state'] = {
            'cookiejar_cookies': list(self.cookies.cookiejar),
        }
        return conf
571345
def generate_mock_config(self, release):
        """"""
        mock_tmpl = pkg_resources.resource_string(__name__, 'templates/mock.mako')
        mock_dir = release['mock_dir'] = os.path.join(release['tmp_dir'], 'mock')
        mock_cfg = os.path.join(release['mock_dir'], release['mock'] + '.cfg')
        os.mkdir(mock_dir)
        for cfg in ('site-defaults.cfg', 'logging.ini'):
            os.symlink('/etc/mock/%s' % cfg, os.path.join(mock_dir, cfg))
        with file(mock_cfg, 'w') as cfg:
            mock_out = Template(mock_tmpl).render(**release)
            self.log.debug('Writing %s:\n%s', mock_cfg, mock_out)
            cfg.write(mock_out)
922373
def save_config(self, out_file_name):
        

        def get_hidden_parameter(item):

            numer_of_sub_elements = item.childCount()

            if numer_of_sub_elements == 0:
                dictator = {item.name : item.visible}
            else:
                dictator = {item.name:{}}
                for child_id in range(numer_of_sub_elements):
                    dictator[item.name].update(get_hidden_parameter(item.child(child_id)))
            return dictator

        out_file_name = str(out_file_name)
        if not os.path.exists(os.path.dirname(out_file_name)):
            os.makedirs(os.path.dirname(out_file_name))

        # build a dictionary for the configuration of the hidden parameters
        dictator = {}
        for index in range(self.tree_scripts.topLevelItemCount()):
            script_item = self.tree_scripts.topLevelItem(index)
            dictator.update(get_hidden_parameter(script_item))

        dictator = {"gui_settings": self.gui_settings, "scripts_hidden_parameters":dictator}

        # update the internal dictionaries from the trees in the gui
        for index in range(self.tree_scripts.topLevelItemCount()):
            script_item = self.tree_scripts.topLevelItem(index)
            self.update_script_from_item(script_item)

        dictator.update({'instruments': {}, 'scripts': {}, 'probes': {}})

        for instrument in self.instruments.values():
            dictator['instruments'].update(instrument.to_dict())
        for script in self.scripts.values():
            dictator['scripts'].update(script.to_dict())

        for instrument, probe_dict in self.probes.items():
            dictator['probes'].update({instrument: ','.join(list(probe_dict.keys()))})

        with open(out_file_name, 'w') as outfile:
            tmp = json.dump(dictator, outfile, indent=4)
983715
def Initialize(config=None,
               external_hostname = None,
               admin_password = None,
               redownload_templates = False,
               repack_templates = True,
               token = None):
  """"""

  print("Checking write access on config %s" % config["Config.writeback"])
  if not os.access(config.parser.filename, os.W_OK):
    raise IOError("Config not writeable (need sudo?)")

  print("\nStep 0: Importing Configuration from previous installation.")
  options_imported = 0
  prev_config_file = config.Get("ConfigUpdater.old_config", default=None)
  if prev_config_file and os.access(prev_config_file, os.R_OK):
    print("Found config file %s." % prev_config_file)
    # pytype: disable=wrong-arg-count
    if builtins.input("Do you want to import this configuration? "
                      "[yN]: ").upper() == "Y":
      options_imported = ImportConfig(prev_config_file, config)
    # pytype: enable=wrong-arg-count
  else:
    print("No old config file found.")

  print("\nStep 1: Setting Basic Configuration Parameters")
  print("We are now going to configure the server using a bunch of questions.")
  ConfigureDatastore(config)
  ConfigureUrls(config, external_hostname=external_hostname)
  ConfigureEmails(config)

  print("\nStep 2: Key Generation")
  if config.Get("PrivateKeys.server_key", default=None):
    if options_imported > 0:
      print("Since you have imported keys from another installation in the "
            "last step,\nyou probably do not want to generate new keys now.")
    # pytype: disable=wrong-arg-count
    if (builtins.input("You already have keys in your config, do you want to"
                       " overwrite them? [yN]: ").upper() or "N") == "Y":
      config_updater_keys_util.GenerateKeys(config, overwrite_keys=True)
    # pytype: enable=wrong-arg-count
  else:
    config_updater_keys_util.GenerateKeys(config)

  FinalizeConfigInit(
      config,
      token,
      admin_password=admin_password,
      redownload_templates=redownload_templates,
      repack_templates=repack_templates,
      prompt=True)
1218066
def cli(  # pylint: disable=too-many-arguments
        ctx, target, config, c, commits, extra_path, ignore, msg_filename,
        verbose, silent, debug,
):
    

    try:
        if debug:
            logging.getLogger("gitlint").setLevel(logging.DEBUG)

        log_system_info()

        # Get the lint config from the commandline parameters and
        # store it in the context (click allows storing an arbitrary object in ctx.obj).
        config, config_builder = build_config(ctx, target, config, c, extra_path, ignore, verbose, silent, debug)

        LOG.debug(u"Configuration\n%s", ustr(config))

        ctx.obj = (config, config_builder, commits, msg_filename)

        # If no subcommand is specified, then just lint
        if ctx.invoked_subcommand is None:
            ctx.invoke(lint)

    except GitContextError as e:
        click.echo(ustr(e))
        ctx.exit(GIT_CONTEXT_ERROR_CODE)
414809
def main(_):
  """"""
  utility.set_up_logging()
  if not FLAGS.config:
    raise KeyError('You must specify a configuration.')
  logdir = FLAGS.logdir and os.path.expanduser(os.path.join(
      FLAGS.logdir, '{}-{}'.format(FLAGS.timestamp, FLAGS.config)))
  try:
    config = utility.load_config(logdir)
  except IOError:
    config = tools.AttrDict(getattr(configs, FLAGS.config)())
    config = utility.save_config(config, logdir)
  for score in train(config, FLAGS.env_processes):
    tf.logging.info('Score {}.'.format(score))