docstr: configure qlib based on the input parameters
  
  The configuration will act like a dictionary.
  
  Normally, it literally is replaced the value according to the keys.
  However, sometimes it is hard for users to set the config when the configuration is nested and complicated
  
  So this API provides some special parameters for users to set the keys in a more convenient way.
  - region:  REG_CN, REG_US
      - several region-related config will be changed
  
  Parameters
  ----------
  default_conf : str
      the default config template chosen by user: "server", "client"
docstr_tok: ["configure","qlib","based","on","the","input","parameters","The","configuration","will","act","like","a","dictionary",".","Normally",",","it","literally","is","replaced","the","value","according","to","the","keys",".","However",",","sometimes","it","is","hard","for","users","to","set","the","config","when","the","configuration","is","nested","and","complicated","So","this","API","provides","some","special","parameters","for","users","to","set","the","keys","in","a","more","convenient","way",".","-","region",":","REG_CN",",","REG_US","-","several","region-related","config","will","be","changed","Parameters","--","--","--","--","--","default_conf",":","str","the","default","config","template","chosen","by","user",":","``","server","''",",","``","client","''"]
code: def set(self, default_conf: str = "client", **kwargs):
      """
      configure qlib based on the input parameters
  
      The configuration will act like a dictionary.
  
      Normally, it literally is replaced the value according to the keys.
      However, sometimes it is hard for users to set the config when the configuration is nested and complicated
  
      So this API provides some special parameters for users to set the keys in a more convenient way.
      - region:  REG_CN, REG_US
          - several region-related config will be changed
  
      Parameters
      ----------
      default_conf : str
          the default config template chosen by user: "server", "client"
      """
      from .utils import (
          set_log_with_config,
          get_module_logger,
          can_use_cache,
      )  # pylint: disable=C0415
  
      self.reset()
  
      _logging_config = kwargs.get(
          "logging_config", self.logging_config
      )
  
      # set global config
      if _logging_config:
          set_log_with_config(_logging_config)
  
      logger = get_module_logger(
          "Initialization",
          kwargs.get("logging_level", self.logging_level),
      )
      logger.info(f"default_conf: {default_conf}.")
  
      self.set_mode(default_conf)
      self.set_region(
          kwargs.get(
              "region", self["region"] if "region" in self else REG_CN
          )
      )
  
      for k, v in kwargs.items():
          if k not in self:
              logger.warning("Unrecognized config %s" % k)
          self[k] = v
  
      self.resolve_path()
  
      if not (
          self["expression_cache"] is None
          and self["dataset_cache"] is None
      ):
          # check redis
          if not can_use_cache():
              log_str = ""
              # check expression cache
              if self.is_depend_redis(self["expression_cache"]):
                  log_str += self["expression_cache"]
                  self["expression_cache"] = None
              # check dataset cache
              if self.is_depend_redis(self["dataset_cache"]):
                  log_str += (
                      f" and {self['dataset_cache']}"
                      if log_str
                      else self["dataset_cache"]
                  )
                  self["dataset_cache"] = None
              if log_str:
                  logger.warning(
                      f"redis connection failed(host={self['redis_host']} port={self['redis_port']}), "
                      f"{log_str} will not be used!"
                  )
  
imports: from __future__ import annotations
  import os
  import re
  import copy
  import logging
  import platform
  import multiprocessing
  from pathlib import Path
  from typing import Callable, Optional, Union
  from typing import TYPE_CHECKING
  from qlib.constant import REG_CN, REG_US, REG_TW
label_desc: Use image node_id 7 for calling the QlibConfig obj's underlying member method code with example usage: obj.set(default_conf) without return types