Source configuration file.
575
def source_file(pymux, variables):
    
    filename = os.path.expanduser(variables['<filename>'])
    try:
        with open(filename, 'rb') as f:
            for line in f:
                line = line.decode('utf-8')
                handle_command(pymux, line)
    except IOError as e:
        raise CommandException('IOError: %s' % (e, ))
941425
def configs_in(src_dir):
    """"""
    for filename in files_in_dir(src_dir, 'json'):
        with open(os.path.join(src_dir, filename), 'rb') as in_f:
            yield json.load(in_f)
737633
def main():
    """"""
    # Read config file. This has to get updated via git
    project_root = utils.get_project_root()
    infofile = os.path.join(project_root, "raw-datasets/info.yml")
    logging.info("Read '%s'...", infofile)
    with open(infofile, 'r') as ymlfile:
        datasets = yaml.load(ymlfile)
    for dataset in datasets:
        local_path_file = os.path.join(project_root, dataset['online_path'])
        i = 0
        while not is_file_consistent(local_path_file, dataset['md5']) and i < 3:
            if os.path.isfile(local_path_file):
                local_file_size = os.path.getsize(local_path_file)
                logging.info("MD5 codes differ. ")
                logging.info("The file size of the downloaded file is %s.",
                             utils.sizeof_fmt(local_file_size))
            logging.info("Download the file '%s'...", dataset['online_path'])
            urllib.urlretrieve(dataset['url'], local_path_file)
            i += 1
        if i < 10:
            logging.info("Found '%s'.", dataset['online_path'])
253394
def config_files(override)
      # Adjust verbosity quickly
      Bunto.logger.adjust_verbosity(
        :quiet   => quiet?(override),
        :verbose => verbose?(override)
      )

      # Get configuration from <source>/_config.yml or <source>/<config_file>
      config_files = override.delete("config")
      if config_files.to_s.empty?
        default = %w(yml yaml).find(-> { "yml" }) do |ext|
          File.exist?(Bunto.sanitized_path(source(override), "_config.#{ext}"))
        end
        config_files = Bunto.sanitized_path(source(override), "_config.#{default}")
        @default_config_file = true
      end
      config_files = [config_files] unless config_files.is_a? Array
      config_files
    end
237115
def _config(self):
        """"""
        cfg_wr = self.repo.config_writer()
        cfg_wr.add_section('user')
        cfg_wr.set_value('user', 'name', self.metadata.author)
        cfg_wr.set_value('user', 'email', self.metadata.email)
        cfg_wr.release()
1011760
def load_config(self, config_source, parameters_source):
        """"""
        with open(config_source) as config_source:
            config_raw = config_source.read()

            parameters = {}
            """Parameteres from file"""
            if os.path.isfile(parameters_source):
                params = self.load_parameters(parameters_source)
                if params is not None:
                    parameters.update(params)

            """Overwrite parameteres with the environment variables"""
            env_params = {}
            env_params.update(os.environ)
            for k, v in env_params.items():
                if is_string(v):
                    env_params[k] = "'" + v + "'"

            parameters.update(env_params)

            """Replace the parameters"""
            final_configuration = config_raw.format(**parameters)
            final_configuration = yaml.safe_load(final_configuration)
            return final_configuration if final_configuration is not None else {}
141126
def add_config_source(self, config_source, position=None):
        
        rank = position if position is not None else len(self._config_sources)
        self._config_sources.insert(rank, config_source)
1091294
def _add_user_source(self):
        
        filename = self.user_config_path()
        if os.path.isfile(filename):
            self.add(ConfigSource(load_yaml(filename) or {}, filename))
185406
def save(self, filename=None, debug=False):
        """"""
        if not filename: filename = self.name
        with open(filename, "w") as f: # save config data file
            f.write(self.toJson(self.attrs))
        if self.debug or debug:
            print("saved configuration %s"%(self.name))
            for k,v in sorted(iteritems(self.attrs)):
                print("%15s : %s"%(k,v))
786512
def configure(paths, relative_to):

    """"""

    if not paths:
        return
    for path in [normalize_path(p, relative_to) for p in paths]:
        logger.debug('configuration path {0}'.format(path))
        pubkeys_path = join(path, PUBKEYSDIR)
        if os.path.exists(pubkeys_path):
            load_pubkeys(pubkeys_path, PUBKEYS)
        init_module(path)
690136
def config_maker(project_name, path):
    """"""

    with open(skeleton_path("config.py"), "r") as config_source:
        config_content = config_source.read()

    config_content = config_content.replace("__PROJECT_NAME__", project_name)

    with open(path, "w") as config_dest:
        config_dest.write(config_content)
1061192
def config():
    ''''''
    if hasattr(current_app, 'settings_file'):
        log.info('Loaded configuration from %s', current_app.settings_file)

    log.info(white('Current configuration'))
    for key in sorted(current_app.config):
        if key.startswith('__') or not key.isupper():
            continue
        echo('{0}: {1}'.format(white(key), current_app.config[key]))
1060386
private function verifySource()
    {
        if (empty($this->source)) {
            throw ConfigurationException::noSourceProvided();
        }
        if (! $this->source->valid()) {
            throw FileNotFoundException::fileNotFound($this->source->path());
        }
    }
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))
1360240
def source_rvm_environment
      rvm_path = config_value_for(:rvm_path, self.class.default_rvm_path, false)
      actual_config = defined_config.merge('rvm_path' => rvm_path)
      config = []
      actual_config.each_pair do |k, v|
        config << "#{k}=#{escape_argument(v.to_s)}"
      end
      run_silently "export #{config.join(" ")}"
      run_silently :source, File.join(rvm_path, "scripts", "rvm")
    end
1310558
def build_config(config_file=get_system_config_directory()):
    
    config = Config(config_file, allow_no_value=True)
    application_versions = find_applications_on_system()

    # Add found versions to config if they don't exist. Versions found
    # in the config file takes precedence over versions found in PATH.
    for item in application_versions.iteritems():
        if not config.has_option(Config.EXECUTABLES, item[0]):
            config.set(Config.EXECUTABLES, item[0], item[1])
    return config
1308423
def checkConfig():
    """"""
    config_file_dir = os.path.join(cwd, "config.py")
    if os.path.exists(config_file_dir):
        print("Making a backup of your config file!")
        config_file_dir2 = os.path.join(cwd, "config.py.oldbak")
        copyfile(config_file_dir, config_file_dir2)