class_docstr: Helper class responsible for reading h2o config files.
  
  This module will look for file(s) named ".h2oconfig" in the current folder, in all parent folders, and finally in
  the user's home directory. The first such file found will be used for configuration purposes. The format for such
  file is a simple "key = value" store, with possible section names in square brackets. Single-line comments starting
  with '#' are also allowed.
class_docstr_tok: ["Helper","class","responsible","for","reading","h2o","config","files",".","This","module","will","look","for","file","(","s",")","named","``",".h2oconfig","''","in","the","current","folder",",","in","all","parent","folders",",","and","finally","in","the","user","'s","home","directory",".","The","first","such","file","found","will","be","used","for","configuration","purposes",".","The","format","for","such","file","is","a","simple","``","key","=","value","''","store",",","with","possible","section","names","in","square","brackets",".","Single-line","comments","starting","with","'","#","'","are","also","allowed","."]
docstr: Find and parse config file, storing all variables in ``self._config``.
docstr_tok: ["Find","and","parse","config","file",",","storing","all","variables","in","``","self._config","``","."]
code: def read_config(self):
      """Find and parse config file, storing all variables in ``self._config``."""
      self._config_loaded = True
      conf = []
      for f in self._candidate_log_files():
          if os.path.isfile(f):
              self._logger.info("Reading config file %s" % f)
              section_rx = re.compile(r"^\[(\w+)\]$")
              keyvalue_rx = re.compile(r"^(\w+:)?([\w.]+)\s*=(.*)$")
              with io.open(f, "rt", encoding="utf-8") as config_file:
                  section_name = None
                  for lineno, line in enumerate(config_file):
                      line = line.strip()
                      if line == "" or line.startswith("#"):
                          continue
                      m1 = section_rx.match(line)
                      if m1:
                          section_name = m1.group(1)
                          continue
                      m2 = keyvalue_rx.match(line)
                      if m2:
                          lng = m2.group(1)
                          key = m2.group(2)
                          val = m2.group(3).strip()
                          if lng and lng.lower() != "py:":
                              continue
                          if section_name:
                              key = section_name + "." + key
                          if (
                              key
                              in H2OConfigReader._allowed_config_keys
                          ):
                              conf.append((key, val))
                          else:
                              self._logger.error(
                                  "Key %s is not a valid config key"
                                  % key
                              )
                          continue
                      self._logger.error(
                          "Syntax error in config file line %d: %s"
                          % (lineno, line)
                      )
              self._config = dict(conf)
              return self._config
  
file_path: h2o-3/h2o-py/h2o/utils/config.py
imports: import io
  import logging
  import os
  import re
label_desc: Use image node_id 4 for calling the H2OConfigReader obj's underlying member method code with example usage: obj.read_config() and returns: self