Does the default configuration by trying to locate the default
config file as defined in the System properties.
969592
private static void configure()
    {
        String propertyFile = System.getProperty( SYSTEM_PROPERTY, PROPERTYFILENAME );

        InputStream in = findConfigFile( propertyFile,
                                         "/com/ecyrd/speed4j/default_speed4j.properties");

        configure(in);
    }
706646
def get_configuration(config_file=None):
    
    parser = configparser.ConfigParser()
    if config_file is None:
        # fallback to default user config file
        config_file = os.path.join(os.getenv("HOME"), DEFAULT_USER_INI)
        if not os.path.isfile(config_file):
            config_file = None
    else:
        if not os.path.isfile(config_file):
            raise ValueError("%s is not a file" % config_file)

    configs = [get_filename(PRESETS_INI)]
    if config_file:
        configs.append(config_file)
    LOG.debug("Attempting to read configuration from %r", configs)
    read_configs = parser.read(configs)
    LOG.debug("Successfully read configuration from %r", read_configs)
    LOG.debug("config file sections: %r", parser.sections())
    return parser
619590
private static Configuration getDefault(){
        Configuration config = new Configuration();
        config.addHandler(new ConsoleAuditHandler());
        config.setMetaData(new DummyMetaData());
        config.setLayout(new SimpleLayout());
        config.addProperty("log.file.location", "user.dir");
        return config;
    }
405655
def _init_config(self):
        

        system = platform.system().lower()
        leveldb_fallback_dir = os.path.expanduser("~")
        if system.startswith("darwin"):
            leveldb_fallback_dir = os.path.join(
                leveldb_fallback_dir, "Library", "Ethereum"
            )
        elif system.startswith("windows"):
            leveldb_fallback_dir = os.path.join(
                leveldb_fallback_dir, "AppData", "Roaming", "Ethereum"
            )
        else:
            leveldb_fallback_dir = os.path.join(leveldb_fallback_dir, ".ethereum")
        leveldb_fallback_dir = os.path.join(leveldb_fallback_dir, "geth", "chaindata")

        if not os.path.exists(self.config_path):
            log.info("No config file found. Creating default: " + self.config_path)
            open(self.config_path, "a").close()

        config = ConfigParser(allow_no_value=True)
        config.optionxform = str
        config.read(self.config_path, "utf-8")
        if "defaults" not in config.sections():
            self._add_default_options(config)

        if not config.has_option("defaults", "leveldb_dir"):
            self._add_leveldb_option(config, leveldb_fallback_dir)

        if not config.has_option("defaults", "dynamic_loading"):
            self._add_dynamic_loading_option(config)

        with codecs.open(self.config_path, "w", "utf-8") as fp:
            config.write(fp)

        leveldb_dir = config.get(
            "defaults", "leveldb_dir", fallback=leveldb_fallback_dir
        )
        return os.path.expanduser(leveldb_dir)
1152190
static Path getSystemPropertyConfigFilePath() {
        final String path = System.getProperty(SYSTEM_PROPERTY_CONFIG_VARIABLE_NAME);
        return Paths.get(path);
    }
802517
def check_config(self, section, name, has_default=False, value=None, allowEmpty=False):
    
    

    cfg = self.config
    if not cfg.has_key(section) or not cfg.get(section).has_key(name):
      if not has_default:
        self.config_errors.append("%s: %s -> missing" % (section, name))
        return False
      else:
        return True

    v = cfg.get(section).get(name)

    if v == "" and not allowEmpty:
      self.config_errors.append("%s: %s -> empty" % (section, name))
      return False
    return True
723137
private void checkForConfigPath(File configFile) {
        String desktopLayoutFilePath = configFile.getAbsolutePath();
        String configDirPath = desktopLayoutFilePath.substring(0, desktopLayoutFilePath.lastIndexOf(System
                .getProperty("file.separator")));
        File configDir = new File(configDirPath);

        // create config dir if it does not exist
        if (!configDir.exists()) {
            boolean success = configDir.mkdirs();
            if(success)
                logger.debug("Newly created config directory");
            else
                logger.warn("Could not create config directory");
        }
    }
825577
def _find_config(self, config_file):
        
        msg = ('Configuration file [ %s ] was not found.' % self.filename)
        self.log.fatal(msg)
        raise IOError(msg)
404047
private void readPropertiesFiles() {

        if (this.configurationFileWildcard.isEmpty() || this.configurationFileExtension.isEmpty()) {
            // Skip configuration loading
            LOGGER.log(SKIP_CONF_LOADING);

        } else {
            // Assemble the regex pattern
            final Pattern filePattern = Pattern.compile(this.configurationFileWildcard + "\\." + this.configurationFileExtension);

            // Retrieve all resources from default classpath
            final Collection<String> list = ClasspathUtility.getClasspathResources(filePattern);

            LOGGER.log(CONFIG_FOUND, list.size(), list.size() > 1 ? "s" : "");

            for (final String confFilename : list) {
                readPropertiesFile(confFilename);
            }
        }
    }
1242381
def get_default_config_file_path(init_filename=None):
    """"""
    prm_dir = get_package_prm_dir()
    if not init_filename:
        init_filename = DEFAULT_FILENAME
    src = os.path.join(prm_dir, init_filename)
    return src
839648
def get_default_config_directory():
        
        test_path = os.path.dirname(os.path.realpath(inspect.getouterframes(inspect.currentframe())[2][1]))
        return os.path.join(test_path, 'conf')
1225471
def create_default_config():
    
    import codecs
    config = ConfigParser.SafeConfigParser()
    config.readfp(StringIO(DEFAULT_CONFIG))

    # Load user settings
    filename = get_user_config_filename()
    if not os.path.exists(filename):
        from wizard import setup_wizard
        setup_wizard(config)
    else:
        try:
            fi = codecs.open(filename, 'r', encoding='utf-8')
            config.readfp(fi)
        finally:
            fi.close()
    return config
295559
def _read_config(self):
        
        default_config_filepath = Path2(os.path.dirname(__file__), DEAFULT_CONFIG_FILENAME)
        log.debug("Read defaults from: '%s'" % default_config_filepath)
        if not default_config_filepath.is_file():
            raise RuntimeError(
                "Internal error: Can't locate the default .ini file here: '%s'" % default_config_filepath
            )
        config = self._read_and_convert(default_config_filepath, all_values=True)
        log.debug("Defaults: %s", pprint.pformat(config))

        self.ini_filepath = get_ini_filepath()
        if not self.ini_filepath:
            # No .ini file made by user found
            # -> Create one into user home
            self.ini_filepath = get_user_ini_filepath()

            # We don't use shutil.copyfile here, so the line endings will
            # be converted e.g. under windows from \n to \n\r
            with default_config_filepath.open("r") as infile:
                with self.ini_filepath.open("w") as outfile:
                    outfile.write(infile.read())

            print("\n*************************************************************")
            print("Default config file was created into your home:")
            print("\t%s" % self.ini_filepath)
            print("Change it for your needs ;)")
            print("*************************************************************\n")
        else:
            print("\nread user configuration from:")
            print("\t%s\n" % self.ini_filepath)
            config.update(self._read_and_convert(self.ini_filepath, all_values=False))
            log.debug("RawConfig changed to: %s", pprint.pformat(config))

        return config
1119255
private void readConfigFile() {
    File configFile = new File(CONFIG_FILE_PATH);
    /* config file is not there -> create config file with default */
    if (!configFile.exists()) {
      resetConfigToDefault();
    }

    try {
      PropertiesConfiguration conf = new PropertiesConfiguration(CONFIG_FILE_PATH);
      chemistry = conf.getString(CHEMISTRY_PLUGIN);
    } catch (ConfigurationException e) {
      resetConfigToDefault();
      e.printStackTrace();
    }
  }
1120121
def has_default_file(cls):
        """"""
        for filename in cls.config_files:
            for searchpath in cls.config_searchpath:
                path = os.path.join(searchpath, filename)
                if os.path.exists(path):
                    return True

        return False
1060582
def _default(cls, opts):
        """"""
        logging.basicConfig(level=logging.INFO, format=cls._log_format)
        return True
1194804
def _check_config():
    """"""
    config.CONFIG_DIR.mkdir(parents=True, exist_ok=True)
    verfile = config.CONFIG_DIR / '.version'
    uptodate = verfile.is_file() and verfile.read_text() == __version__
    if not uptodate:
        verfile.write_text(__version__)
    if not (uptodate and config.CONFIG_FILE.is_file()):
        conf.create_config_(update=True)
    for stfile in ('stagpy-paper.mplstyle',
                   'stagpy-slides.mplstyle'):
        stfile_conf = config.CONFIG_DIR / stfile
        if not (uptodate and stfile_conf.is_file()):
            stfile_local = pathlib.Path(__file__).parent / stfile
            shutil.copy(str(stfile_local), str(stfile_conf))