Reads the INI file and load its contentens into a section collection after
parsing the file line by line.
196356
private void loadStream(InputStream stream)
    {
        int            iPos       = -1;
        String         strLine    = null;
        String         strSection = null;
        String         strRemarks = null;
        BufferedReader objBRdr    = null;
        InputStreamReader     objFRdr    = null;
        INISection     objSec     = null;

        try
        {
            objFRdr = new InputStreamReader(stream);
            if (objFRdr != null)
            {
                objBRdr = new BufferedReader(objFRdr);
                if (objBRdr != null)
                {
                    while (objBRdr.ready())
                    {
                        iPos = -1;
                        strLine  = null;
                        strLine = objBRdr.readLine().trim();
                        if (strLine == null)
                        {
                        }
                        else if (strLine.length() == 0)
                        {
                        }
                        else if (strLine.substring(0, 1).equals(";"))
                        {
                            if (strRemarks == null)
                                strRemarks = strLine.substring(1);
                            else if (strRemarks.length() == 0)
                                strRemarks = strLine.substring(1);
                            else
                                strRemarks = strRemarks + "\r\n" + strLine.substring(1);
                        }
                        else if (strLine.startsWith("[") && strLine.endsWith("]"))
                        {
                            // Section start reached create new section
                            if (objSec != null) 
                                this.mhmapSections.put(strSection.trim(), objSec);
                            objSec = null;
                            strSection = strLine.substring(1, strLine.length() - 1);
                            objSec = new INISection(strSection.trim(), strRemarks);
                            strRemarks = null;
                        }
                        else if ((iPos = strLine.indexOf("=")) > 0 && objSec != null)
                        {
                            // read the key value pair 012345=789
                            objSec.setProperty(strLine.substring(0, iPos).trim(), 
                                                strLine.substring(iPos + 1).trim(), 
                                                strRemarks);
                            strRemarks = null;
                        }
                        else 
                        {
                            objSec.setProperty(strLine, "", strRemarks);
                      
                        }
                    }
                    if (objSec != null)
                        this.mhmapSections.put(strSection.trim(), objSec);
                    this.mblnLoaded = true;
                }
            }
        }
        catch (FileNotFoundException FNFExIgnore)
        {
            this.mhmapSections.clear();
        }
        catch (IOException IOExIgnore)
        {
            this.mhmapSections.clear();
        }
        catch (NullPointerException NPExIgnore)
        {
            this.mhmapSections.clear();
        }
        finally
        {
            if (objBRdr != null)
            {
                closeReader(objBRdr);
                objBRdr = null;
            }
            if (objFRdr != null)
            {
                closeReader(objFRdr);
                objFRdr = null;
            }
            if (objSec != null) objSec = null;
        }
    }
343877
def _load_from_ini_py3(ini, default_section=_DEFAULT_SECTION):
    

    cf = configparser.ConfigParser(default_section=default_section)
    cf.read(ini, encoding="UTF8")
    settings = OrderedDict()
    for item in cf.items():
        logger.debug(item[0])
        settings[item[0].upper()] = OrderedDict(item[1])

    logger.debug(settings)
    for k, v in cf.items(default_section):
    # for k, v in cf.items():
        logger.debug(v)
        logger.debug(settings)
        logger.debug(settings.get(k))
        settings[k.upper()] = convert_value(v)
        logger.debug(settings)
        if k.lower() in settings:
            del settings[k.lower()]

    if default_section in settings:
        del settings[default_section]

    logger.debug(settings)
    return settings
971475
def from_file(cls, f):
        """"""
        ret = cls()
        section = None
        setting = None
        for lineno, line in enumerate(f.readlines()):
            line = line.lstrip()
            if setting is None:
                if _strip_comments(line).strip() == "":
                    continue
                if line[0] == "[":
                    line = _strip_comments(line).rstrip()
                    if line[-1] != "]":
                        raise ValueError("expected trailing ]")
                    key = line.strip()
                    pts = key[1:-1].split(" ", 1)
                    pts[0] = pts[0].lower()
                    if len(pts) == 2:
                        if pts[1][0] != "\"" or pts[1][-1] != "\"":
                            raise ValueError(
                                "Invalid subsection " + pts[1])
                        else:
                            pts[1] = pts[1][1:-1]
                        if not _check_section_name(pts[0]):
                            raise ValueError("invalid section name %s" %
                                             pts[0])
                        section = (pts[0], pts[1])
                    else:
                        if not _check_section_name(pts[0]):
                            raise ValueError("invalid section name %s" %
                                    pts[0])
                        pts = pts[0].split(".", 1)
                        if len(pts) == 2:
                            section = (pts[0], pts[1])
                        else:
                            section = (pts[0], )
                    ret._values[section] = {}
                else:
                    if section is None:
                        raise ValueError("setting %r without section" % line)
                    try:
                        setting, value = line.split("=", 1)
                    except ValueError:
                        setting = line
                        value = "true"
                    setting = setting.strip().lower()
                    if not _check_variable_name(setting):
                        raise ValueError("invalid variable name %s" % setting)
                    if value.endswith("\\\n"):
                        value = value[:-2]
                        continuation = True
                    else:
                        continuation = False
                    value = _parse_string(value)
                    ret._values[section][setting] = value
                    if not continuation:
                        setting = None
            else:  # continuation line
                if line.endswith("\\\n"):
                    line = line[:-2]
                    continuation = True
                else:
                    continuation = False
                value = _parse_string(line)
                ret._values[section][setting] += value
                if not continuation:
                    setting = None
        return ret
1064280
def _read_sections(ifile):
        """"""
        if os.path.exists(ifile):
            return read_sections(ifile, exclude_ungrouped=True, prt=None)
515523
def _read_ini_config(ini_file_contents: str) -> Dict[str, str]:
    
    config = configparser.ConfigParser()
    config.optionxform = str
    config.read_string(_FAKE_SECTION + ini_file_contents)

    items = {}
    for section in config.sections():
        items.update(dict(config[section].items()))

    return items
478132
private void load() {
    Iterator iterator = loaders.iterator();
    while (iterator.hasNext()) {
      MacroLoader loader = (MacroLoader) iterator.next();
      loader.setRepository(this);
      log.debug("Loading from: " + loader.getClass());
      loader.loadPlugins(this);
    }
  }
42942
def load(cls, fname):
        
        with open(fname) as f:
            content = f.readlines()
        return Flow.from_json(''.join(content))
466995
protected function processFile()
    {
        $arr = parse_ini_file($this->file->getAbsolutePath(), true);

        if ($this->section !== null) {
            if (isset($arr[$this->section])) {
                $this->processSection($arr[$this->section]);
            }

            return;
        }

        $values = array_values($arr);

        if (!is_array($values[0])) {
            $this->processSection($arr);

            return;
        }

        foreach ($values as $subArr) {
            $this->processSection($subArr);
        }
    }
1085841
def parse_content(self, content):
        
        self.lines = content
        for scanner in self.scanners:
            scanner(self)
739826
def read_lines(in_file):
    """"""

    with open(in_file, 'r') as inf:
        in_contents = inf.read().split('\n')
    return in_contents
800204
private function readWithAlternativeImplementation($ini)
    {
        $ini = $this->splitIniContentIntoLines($ini);

        if (count($ini) == 0) {
            return array();
        }

        $sections = array();
        $values = array();
        $result = array();
        $globals = array();
        $i = 0;
        foreach ($ini as $line) {
            $line = trim($line);
            $line = str_replace("\t", " ", $line);

            // Comments
            if (!preg_match('/^[a-zA-Z0-9[]/', $line)) {
                continue;
            }

            // Sections
            if ($line{0} == '[') {
                $tmp = explode(']', $line);
                $sections[] = trim(substr($tmp[0], 1));
                $i++;
                continue;
            }

            // Key-value pair
            list($key, $value) = explode('=', $line, 2);
            $key = trim($key);
            $value = trim($value);
            if (strstr($value, ";")) {
                $tmp = explode(';', $value);
                if (count($tmp) == 2) {
                    if ((($value{0} != '"') && ($value{0} != "'")) ||
                        preg_match('/^".*"\s*;/', $value) || preg_match('/^".*;[^"]*$/', $value) ||
                        preg_match("/^'.*'\s*;/", $value) || preg_match("/^'.*;[^']*$/", $value)
                    ) {
                        $value = $tmp[0];
                    }
                } else {
                    if ($value{0} == '"') {
                        $value = preg_replace('/^"(.*)".*/', '$1', $value);
                    } elseif ($value{0} == "'") {
                        $value = preg_replace("/^'(.*)'.*/", '$1', $value);
                    } else {
                        $value = $tmp[0];
                    }
                }
            }

            $value = trim($value);

            // Special keywords
            if ($value === 'true' || $value === 'yes' || $value === 'on') {
                $value = true;
            } elseif ($value === 'false' || $value === 'no' || $value === 'off') {
                $value = false;
            } elseif ($value === '' || $value === 'null') {
                $value = null;
            }

            if (is_string($value)) {
                $value = trim($value, "'\"");
            }

            if ($i == 0) {
                if (substr($key, -2) == '[]') {
                    $globals[substr($key, 0, -2)][] = $value;
                } else {
                    $globals[$key] = $value;
                }
            } else {
                if (substr($key, -2) == '[]') {
                    $values[$i - 1][substr($key, 0, -2)][] = $value;
                } else {
                    $values[$i - 1][$key] = $value;
                }
            }
        }

        for ($j = 0; $j < $i; $j++) {
            if (isset($values[$j])) {
                $result[$sections[$j]] = $values[$j];
            } else {
                $result[$sections[$j]] = array();
            }
        }

        $finalResult = $result + $globals;

        return $this->decode($finalResult, $finalResult);
    }
725859
protected static function loadIni( $fileName )
	{
		$reader	= new FS_File_INI_Reader( $fileName, TRUE );
		$ini	= $reader->getCommentedProperties();
		foreach( $ini as $sectionName => $sectionData )
		{
			foreach( $sectionData as $pair )
			{
				$item	= array(
					'key'		=> $pair['key'],
					'value'		=> $pair['value'],
					'type'		=> "string",
				);
				if( isset( $pair['comment'] ) )
				{
					$matches	= array();
					if( preg_match_all( self::$iniTypePattern, $pair['comment'], $matches ) )
					{
						$item['type']		= $matches[1][0];
						if( $matches[2][0] )
							$item['comment']	= $matches[2][0];
						settype( $item['value'], $item['type'] );
					}
					else
						$item['comment']	= $pair['comment'];
				}
				$data[$sectionName][]	= $item;
			}
		}
		return $data;
	}
969850
def read_collection(self, filename):
        
        with open(filename, 'rb') as fd:
            lines = fd.read().decode('utf-8-sig').splitlines()
        collection = list(filter(bool, [line.strip() for line in lines]))
        return collection
668777
def consume_file(self, infile):
        """"""
        reader = tag.reader.GFF3Reader(infilename=infile)
        self.consume(reader)
853709
public synchronized void load2() throws IOException {
        COL result = create();

        if (exists()) {
            try (LinesStream stream = linesStream()) {
                for (String line : stream) {
                    if (line.startsWith("#")) continue;   // comment
                    T r = parse(line);
                    if (r != null)
                        result.add(r);
                }
            }
        }

        parsed = readOnly(result);
    }
65254
void parse(File file) throws ParseException {
        if (file == null) {
            Log.warn("parsing NULL file, so fallback on default configuration!");
            return;
        }
        if (!file.exists()) {
            Log.warn(String.format("parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()));
            return;
        }
        try {
            FileReader reader = new FileReader(file);
            parse(reader);
        } catch (FileNotFoundException fex) {
            Log.warn(String.format("parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()), fex);
            return;
        }
    }
50683
private function _parseIni($iniFile)
    {
        $aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
        $tmpArray = array();
        foreach ($aParsedIni as $key=>$value) {
            if (strpos($key, ':') !== false) {
                $sections = explode(':', $key);
                if (count($sections) != 2) {
                    throw new Exception('Malformed section header!');
                }
                $currentSection = trim($sections[0]);
                $parentSection = trim($sections[1]);
                $value = array_merge_recursive(
                    $aParsedIni[$parentSection],
                    $aParsedIni[$key]
                );
                $aParsedIni[$currentSection] = $value;
                unset($aParsedIni[$key]);
                $key = $currentSection;
            }
            if (is_array($value)) {
                foreach ($value as $vk=>$vv) {
                    $newKey = $key.".".$vk;
                    $tmpArray[$newKey] = $vv;
                    if (
                           is_string($vv) &&
                           preg_match_all('/\${([a-zA-Z0-9\.]+)}/', $vv, $match)
                        ) {
                        if (!isset($match[1])) {
                            continue;
                        }
                        $variableKey = $match[1];
                        foreach ($variableKey as &$var) {
                            if (strpos($var, '.') === false) {
                                $var = $key . '.' . $var;
                            }
                        }
                        $this->_varDeps[$newKey] = $variableKey;
                    }
                }
            }
        }
        if (!empty($tmpArray)) {
            $aParsedIni = $tmpArray;
        }
        foreach ($aParsedIni as $key=>$value) {    //extract parsed array keys
            if (array_key_exists($key, $this->_varDeps)) {
                $deps = &$this->_varDeps;
                $value = preg_replace_callback(
                    '/\${([a-zA-Z0-9\.]+)}/',
                    function ($match) use ($key, $aParsedIni, &$deps) {
                        return $aParsedIni[array_shift($deps[$key])];
                    },
                    $value
                );
                $aParsedIni[$key] = $value;
            }
            $this->_tmpValue = $value;//set temporay value to current ini value
            $aXKey = explode($this->_delimiter, $key);    //get ini key segments
            //set object properties recursively based on parsed ini
            $this->_recursiveInit($this->_obj, $aXKey);
        }
    }