Reads properties files and saves them to a config object

        :param conf_properties_files: comma-separated list of properties files
        :returns: config object
321432
def get_config_from_file(conf_properties_files):
        
        # Initialize the config object
        config = ExtendedConfigParser()
        logger = logging.getLogger(__name__)

        # Configure properties (last files could override properties)
        found = False
        files_list = conf_properties_files.split(';')
        for conf_properties_file in files_list:
            result = config.read(conf_properties_file)
            if len(result) == 0:
                message = 'Properties config file not found: %s'
                if len(files_list) == 1:
                    logger.error(message, conf_properties_file)
                    raise Exception(message % conf_properties_file)
                else:
                    logger.debug(message, conf_properties_file)
            else:
                logger.debug('Reading properties from file: %s', conf_properties_file)
                found = True
        if not found:
            message = 'Any of the properties config files has been found'
            logger.error(message)
            raise Exception(message)

        return config
1246100
private void readPropertiesFiles() {

        if (this.messageFileWildcard.isEmpty() || !CoreParameters.LOG_RESOLUTION.get()) {
            // Skip configuration loading
            LOGGER.info(JRebirthMarkers.MESSAGE, "Messages Loading is skipped");

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

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

            LOGGER.info(JRebirthMarkers.MESSAGE, "{} Messages file{} found.", list.size(), list.size() > 1 ? "s" : "");

            for (final String rbFilename : list) {
                readPropertiesFile(rbFilename);
            }
        }
    }
483570
private void createIzouPropertiesFile() {
        String propertiesPath = getMain().getFileSystemManager().getPropertiesLocation() + File.separator
                + IZOU_PROPERTIES_FILE_NAME;

        propertiesFile = new File(propertiesPath);
        if (!propertiesFile.exists()) try (PrintWriter writer = new PrintWriter(propertiesFile.getAbsolutePath(), "UTF-8")) {
            propertiesFile.createNewFile();

            writer.println("# --------------------");
            writer.println("# Izou Properties File");
            writer.println("# --------------------");
            writer.println("#");
            writer.println("# This file has some general configuration options that have to be configured before");
            writer.println("# Izou can run successfully.");
        } catch (IOException e) {
            error("Error while trying to create the new Properties file", e);
        }
    }
1223023
def read_conf_file
      conf = {}
      if File.exists?(CONF_PATH) && File.size?(CONF_PATH)
        # Store valid conf keys
        YAML.load_file(CONF_PATH).each do |key, value|
          if VALID_KEYS.include? key
            conf[key] = value
          else
            say "Invalid configuration key: #{key}"
          end
        end
      end
      conf
    end
1278881
def get_conf_files(filename):
    
    if not os.path.isfile(filename):
        raise ValueError("'%s' is not a file" % filename)
    conf_d_path = "%s.d" % filename
    if not os.path.exists(conf_d_path):
        return [filename]
    return [filename] + get_conf_d_files(conf_d_path)
882229
def _config_file():
    
    config = ConfigParser.SafeConfigParser()
    configs = []

    try:
        configs.append(_user_config_file())
    except Exception, e:
        juicer.utils.Log.log_debug(e)

    config.read(configs)
    return config
296386
def read (self, files=None):
        
        if files is None:
            cfiles = []
        else:
            cfiles = files[:]
        if not cfiles:
            userconf = get_user_config()
            if os.path.isfile(userconf):
                cfiles.append(userconf)
        # filter invalid files
        filtered_cfiles = []
        for cfile in cfiles:
            if not os.path.isfile(cfile):
                log.warn(LOG_CHECK, _("Configuration file %r does not exist."), cfile)
            elif not fileutil.is_readable(cfile):
                log.warn(LOG_CHECK, _("Configuration file %r is not readable."), cfile)
            else:
                filtered_cfiles.append(cfile)
        log.debug(LOG_CHECK, "reading configuration from %s", filtered_cfiles)
        confparse.LCConfigParser(self).read(filtered_cfiles)
230052
def save_configuration_file(self):
        
        if os.path.exists(self.config_file) and not self.config_changed:
            return
        dirname = os.path.dirname(self.config_file)
        try:
            if not os.path.exists(dirname):
                os.makedirs(dirname)
        except (OSError, IOError) as e:
            self.logger.warning("Could not make directory for configuration file: {0}".
                                format(utils.exc_as_decoded_string(e)))
            return
        try:
            with open(self.config_file, 'w') as file:
                csvwriter = csv.writer(file, delimiter='=', escapechar='\\',
                                       lineterminator='\n', quoting=csv.QUOTE_NONE)
                for key, value in self.config_dict.items():
                    csvwriter.writerow([key, value])
            self.config_changed = False
        except (OSError, IOError) as e:
            self.logger.warning("Could not save configuration file: {0}".\
                format(utils.exc_as_decoded_string(e)))
535670
public static Properties readTDConf()
    {
        Properties p = new Properties();
        File file = new File(System.getProperty("user.home", "./"), String.format(".td/td.conf"));
        if (!file.exists()) {
            logger.warn(String.format("config file %s is not found", file));
            return p;
        }
        return readTDConf(file);
    }
1078270
def read(self, config_dir=None, config_name=None, clear=False):
        

# TODO should probably allow config_dir to be a list as well
        # get name of config directory
        if not config_dir:
            config_dir = self._defaults.get('config_dir', None)
        if not config_dir:
            raise KeyError('config_dir not set')

        # get name of config file
        if not config_name:
            config_name = self._defaults.get('config_name', None)
        if not config_name:
            raise KeyError('config_name not set')

        conf_path = os.path.expanduser(config_dir)
        if not os.path.exists(conf_path):
            raise IOError("config dir not found at %s" % (conf_path,))

        config = munge.load_datafile(config_name, conf_path, default=None)

        if not config:
            raise IOError("config file not found in %s" % (conf_path,))

        if clear:
            self.clear()

        munge.util.recursive_update(self.data, config)
        self._meta_config_dir = conf_path
        return self
1254508
def read_config(desired_type: Type[ConfigParser], file_object: TextIOBase,
                logger: Logger, *args, **kwargs) -> ConfigParser:
    

    # see https://docs.python.org/3/library/configparser.html for details
    config = ConfigParser()
    config.read_file(file_object)

    return config
1191720
private Properties loadProperties(File baseDir, Properties currentProperties, String key, boolean override) throws IOException {
        Properties loadedProperties = new Properties();

        String include = (String) currentProperties.remove(key);
        if (!StringUtils.isNullOrEmpty(include)) {
            // allow for multiples
            List<String> names = StringUtils.getList(include, DEFAULT_LIST_DELIMITER);
            for (String name : names) {
                if (StringUtils.isNullOrEmpty(name)) {
                    continue;
                }

                // interpolate any variables
                final String fileName = interpolateString(name);

                // try co-located
                File file = new File(baseDir, fileName);
                if (!file.exists()) {
                    // try absolute path
                    file = new File(fileName);
                }

                if (!file.exists()) {
                    log.warn("failed to locate {}", file);
                    continue;
                }

                // load properties
                log.debug("loading {} settings from {}", key, file);
                try (FileInputStream iis = new FileInputStream(file)) {
                    loadedProperties.load(iis);
                }

                // read nested properties
                loadedProperties = loadProperties(file.getParentFile(), loadedProperties, key, override);
            }
        }

        Properties merged = new Properties();
        if (override) {
            // "override" settings overwrite the current properties
            merged.putAll(currentProperties);
            merged.putAll(loadedProperties);
        } else {
            // "include" settings are overwritten by the current properties
            merged.putAll(loadedProperties);
            merged.putAll(currentProperties);
        }

        return merged;
    }
805886
public static Properties readPropertiesFile(final File file) {
		if (!file.exists()) {
			JKIOUtil.logger.info(String.format("File %s doesnot exists , return empty map", file.getName()));
			return new Properties();
		}
		try {
			InputStream in = new FileInputStream(file);
			if (in != null) {
				return readPropertiesStream(in);
			}
		} catch (IOException e) {
			JKExceptionUtil.handle(e);
		}
		return null;
	}
385738
private void readPropertyFile()
	{
		java.util.Properties props = new java.util.Properties();
	    try
	    {
	        File propertyFile = new File(propertyFilePath + File.separator + PROPERTYFILENAME);
	        if (propertyFile.exists())
	        {
	        	java.io.FileInputStream fis = null;
	        	try
	        	{
			    	fis = new java.io.FileInputStream(propertyFile);
			        props.load(fis);
	        	}
	        	finally
	        	{
	        		if (fis!=null) try { fis.close(); } catch (IOException ex) { Log.error("IGNORED", ex); }
	        	}
	        }

	        searchPath = props.getProperty(PROPERTY_SEARCHPATH, Helpers.HOMEDIR);
			exportPath = props.getProperty(PROPERTY_EXPORTPATH, Helpers.HOMEDIR);
			uiClassName = props.getProperty(PROPERTY_LOOKANDFEEL, javax.swing.UIManager.getSystemLookAndFeelClassName());
			useSystemTray = Boolean.parseBoolean(props.getProperty(PROPERTY_SYSTEMTRAY, "FALSE"));
			currentVolume = Float.parseFloat(props.getProperty(PROPERTY_VOLUME_VALUE, "1.0"));
			currentBalance = Float.parseFloat(props.getProperty(PROPERTY_BALANCE_VALUE, "0.0"));
			lastLoaded = new ArrayList<URL>(PROPERTY_LASTLOADED_MAXENTRIES);
			for (int i=0; i<PROPERTY_LASTLOADED_MAXENTRIES; i++)
			{
				String url = props.getProperty(PROPERTY_LASTLOADED+'.'+i, null);
				if (url!=null) lastLoaded.add(new URL(url)); else lastLoaded.add(null);
			}
			setDSPEnabled(Boolean.parseBoolean(props.getProperty(PROPERTY_EFFECTS_PASSTHROUGH, "FALSE")));
			mainDialogLocation = Helpers.getPointFromString(props.getProperty(PROPERTY_MAINDIALOG_POS, "-1x-1"));
			mainDialogSize = Helpers.getDimensionFromString(props.getProperty(PROPERTY_MAINDIALOG_SIZE, "320x410"));
			playerSetUpDialogLocation = Helpers.getPointFromString(props.getProperty(PROPERTY_SETUPDIALOG_POS, "-1x-1"));
			playerSetUpDialogSize = Helpers.getDimensionFromString(props.getProperty(PROPERTY_SETUPDIALOG_SIZE, "720x230"));
			playerSetUpDialogVisable = Boolean.parseBoolean(props.getProperty(PROPERTY_SETUPDIALOG_VISABLE, "false"));
			modInfoDialogLocation = Helpers.getPointFromString(props.getProperty(PROPERTY_PROPERTIESDIALOG_POS, "-1x-1"));
			modInfoDialogSize = Helpers.getDimensionFromString(props.getProperty(PROPERTY_PROPERTIESDIALOG_SIZE, "520x630"));
			modInfoDialogVisable = Boolean.parseBoolean(props.getProperty(PROPERTY_PROPERTIESDIALOG_VISABLE, "false"));
			playlistDialogLocation = Helpers.getPointFromString(props.getProperty(PROPERTY_PLAYLISTDIALOG_POS, "-1x-1"));
			playlistDialogSize = Helpers.getDimensionFromString(props.getProperty(PROPERTY_PLAYLISTDIALOG_SIZE, "400x400"));
			playlistDialogVisable = Boolean.parseBoolean(props.getProperty(PROPERTY_PLAYLIST_VISABLE, "false"));
			effectsDialogLocation = Helpers.getPointFromString(props.getProperty(PROPERTY_EFFECTDIALOG_POS, "-1x-1"));
			effectsDialogSize = Helpers.getDimensionFromString(props.getProperty(PROPERTY_EFFECTDIALOG_SIZE, "560x470"));
			effectDialogVisable = Boolean.parseBoolean(props.getProperty(PROPERTY_EFFECT_VISABLE, "false"));
			
			if (currentEqualizer!=null)
			{
				boolean isActive = Boolean.parseBoolean(props.getProperty(PROPERTY_EQUALIZER_ISACTIVE, "FALSE"));
				currentEqualizer.setIsActive(isActive);
				float preAmpValueDB = Float.parseFloat(props.getProperty(PROPERTY_EQUALIZER_PREAMP, "0.0"));
				currentEqualizer.setPreAmp(preAmpValueDB);
				for (int i=0; i<currentEqualizer.getBandCount(); i++)
				{
					float bandValueDB = Float.parseFloat(props.getProperty(PROPERTY_EQUALIZER_BAND_PREFIX + Integer.toString(i), "0.0"));
					currentEqualizer.setBand(i, bandValueDB);
				}
			}
			if (currentPitchShift!=null)
			{
				boolean isActive = Boolean.parseBoolean(props.getProperty(PROPERTY_PITCHSHIFT_ISACTIVE, "FALSE"));
				currentPitchShift.setIsActive(isActive);
				float pitchValue = Float.parseFloat(props.getProperty(PROPERTY_PITCHSHIFT_PITCH, "1.0"));
				currentPitchShift.setPitchScale(pitchValue);
				float scaleValue = Float.parseFloat(props.getProperty(PROPERTY_PITCHSHIFT_SAMPLESCALE, "1.0"));
				currentPitchShift.setSampleScale(scaleValue);
				int overSampling = Integer.parseInt(props.getProperty(PROPERTY_PITCHSHIFT_OVERSAMPLING, "32"));
				currentPitchShift.setFFTOversampling(overSampling);
				int frameSize = Integer.parseInt(props.getProperty(PROPERTY_PITCHSHIFT_FRAMESIZE, "8192"));
				currentPitchShift.setFFTFrameSize(frameSize);
			}

			MultimediaContainerManager.configureContainer(props);
	    }
	    catch (Throwable ex)
	    {
			Log.error("[MainForm]", ex);
	    }
	}
124057
public void saveProperties(CmsParameterConfiguration properties, String file, boolean backup) {

        if (new File(m_configRfsPath + file).isFile()) {
            String backupFile = file + CmsConfigurationManager.POSTFIX_ORI;
            String tempFile = file + ".tmp";

            m_errors.clear();

            if (backup) {
                // make a backup copy
                copyFile(file, FOLDER_BACKUP + backupFile);
            }

            //save to temporary file
            copyFile(file, tempFile);

            // save properties
            save(properties, tempFile, file, null);

            // delete temp file
            File temp = new File(m_configRfsPath + tempFile);
            temp.delete();
        } else {
            m_errors.add("No valid file: " + file + "\n");
        }

    }
114991
private void readConfigFile() {

        m_isValid = false;
        if ((null != m_configFile) && m_configFile.exists()) {
            if (m_configFile.canRead()) {
                Properties props = new Properties();
                try (FileInputStream input = new FileInputStream(m_configFile)) {
                    props.load(input);
                    for (Entry<Object, Object> entry : props.entrySet()) {
                        String key = (String)entry.getKey();
                        String propValue = (String)entry.getValue();
                        if (key.equals(DEFAULT_MODULES_TO_EXPORT)) {
                            String value = getValueFromProp(propValue).trim();
                            if (value.contains(",")) {
                                m_configuredModules = Arrays.asList(value.split(" *, *"));
                            } else {
                                m_configuredModules = Arrays.asList(value.split(" +"));
                            }
                        }

                        if (key.equals(DEFAULT_MODULE_PATH)) {
                            m_modulesPath = getValueFromProp(propValue).trim();
                        }

                        if (key.equals(DEFAULT_MODULE_RESOURCES_SUBFOLDER)) {
                            m_resourcesSubfolder = getValueFromProp(propValue).trim();
                        }

                        if (key.equals(DEFAULT_PULL_MODE_BEFORE)) {
                            String value = getValueFromProp(propValue);
                            value = value.trim();
                            if (value.equals("1")) {
                                m_defaultPullModeBefore = true;
                            }
                        }
                        if (key.equals(DEFAULT_PULL_MODE_AFTER)) {
                            String value = getValueFromProp(propValue);
                            value = value.trim();
                            if (value.equals("1")) {
                                m_defaultPullModeAfter = true;
                            }
                        }
                        if (key.equals(DEFAULT_PUSH_MODE)) {
                            String value = getValueFromProp(propValue);
                            value = value.trim();
                            if (value.equals("1")) {
                                m_defaultPushMode = true;
                            }
                        }
                        if (key.equals(DEFAULT_MODULE_EXPORT_PATH)) {
                            String value = getValueFromProp(propValue);
                            m_defaultModuleExportPath = value.trim();
                        }
                        if (key.equals(DEFAULT_REPOSITORY_PATH)) {
                            String value = getValueFromProp(propValue);
                            m_repositoryPath = value.trim();
                        }
                        if (key.equals(DEFAULT_EXPORT_MODE)) {
                            String value = getValueFromProp(propValue);
                            m_defaultExportMode = (value.trim().equals("1")) ? 1 : 0;
                        }
                        if (key.equals(DEFAULT_COMMIT_MESSAGE)) {
                            String value = getValueFromProp(propValue);
                            m_defaultCommitMessage = value;
                        }
                        if (key.equals(DEFAULT_GIT_USER_NAME)) {
                            String value = getValueFromProp(propValue);
                            m_defaultGitUserName = value;
                        }
                        if (key.equals(DEFAULT_GIT_USER_EMAIL)) {
                            String value = getValueFromProp(propValue);
                            m_defaultGitUserEmail = value;
                        }
                        if (key.equals(DEFAULT_EXCLUDE_LIBS)) {
                            String value = getValueFromProp(propValue);
                            m_defaultExcludeLibs = (value.trim().equals("1")) ? true : false;
                        }
                        if (key.equals(DEFAULT_COMMIT_MODE)) {
                            String value = getValueFromProp(propValue);
                            m_defaultCommitMode = (value.trim().equals("1")) ? true : false;
                        }
                        if (key.equals(DEFAULT_IGNORE_UNCLEAN)) {
                            String value = getValueFromProp(propValue);
                            m_defaultIgnoreUnclean = (value.trim().equals("1")) ? true : false;
                        }
                        if (key.equals(DEFAULT_COPY_AND_UNZIP)) {
                            String value = getValueFromProp(propValue);
                            m_defaultCopyAndUnzip = (value.trim().equals("1")) ? true : false;
                        }
                    }
                    m_isValid = true;
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
873295
def _ReadPropertySet(self, property_set):
    
    # Combine the values of multiple property sections
    # but do not override properties that are already set.
    for property_section in property_set.sections:
      if property_section.class_identifier != self._CLASS_IDENTIFIER:
        continue

      for property_value in property_section.properties:
        property_name = self._PROPERTY_NAMES.get(
            property_value.identifier, None)
        if not property_name:
          property_name = '0x{0:04}'.format(property_value.identifier)

        value = self._GetValueAsObject(property_value)
        if self._PROPERTY_VALUE_MAPPINGS:
          value_callback_name = self._PROPERTY_VALUE_MAPPINGS.get(
              property_name, None)
          if value_callback_name:
            value_callback_method = getattr(self, value_callback_name, None)
            if value_callback_method:
              value = value_callback_method(value)

        if property_name in self._DATE_TIME_PROPERTIES:
          properties_dict = self.date_time_properties
          value = dfdatetime_filetime.Filetime(timestamp=value)
        else:
          properties_dict = self._properties

        if property_name not in properties_dict:
          properties_dict[property_name] = value