code: def gen_parameter_code(
      config_hpp: Path, config_out_cpp: Path
  ) -> Tuple[List[Tuple[str, int]], List[List[Dict[str, List]]]]:
      """Generate auto config file.
  
      Parameters
      ----------
      config_hpp : pathlib.Path
          Path to the config header file.
      config_out_cpp : pathlib.Path
          Path to the auto config file.
  
      Returns
      -------
      infos : tuple
          Tuple with names and content of sections.
      """
      keys, infos = get_parameter_infos(config_hpp)
      names = get_names(infos)
      alias = get_alias(infos)
      names_with_aliases = defaultdict(list)
      str_to_write = r"""/*!
   * Copyright (c) 2018 Microsoft Corporation. All rights reserved.
   * Licensed under the MIT License. See LICENSE file in the project root for license information.
   *
   * \note
   * This file is auto generated by LightGBM\helpers\parameter_generator.py from LightGBM\include\LightGBM\config.h file.
   */
  """
      str_to_write += (
          "#include<LightGBM/config.h>\nnamespace LightGBM {\n"
      )
      # alias table
      str_to_write += "const std::unordered_map<std::string, std::string>& Config::alias_table() {\n"
      str_to_write += "  static std::unordered_map<std::string, std::string> aliases({\n"
  
      for pair in alias:
          str_to_write += f'  {{"{pair[0]}", "{pair[1]}"}},\n'
          names_with_aliases[pair[1]].append(pair[0])
      str_to_write += "  });\n"
      str_to_write += "  return aliases;\n"
      str_to_write += "}\n\n"
  
      # names
      str_to_write += "const std::unordered_set<std::string>& Config::parameter_set() {\n"
      str_to_write += (
          "  static std::unordered_set<std::string> params({\n"
      )
  
      for name in names:
          str_to_write += f'  "{name}",\n'
      str_to_write += "  });\n"
      str_to_write += "  return params;\n"
      str_to_write += "}\n\n"
      # from strings
      str_to_write += "void Config::GetMembersFromString(const std::unordered_map<std::string, std::string>& params) {\n"
      str_to_write += '  std::string tmp_str = "";\n'
      for x in infos:
          for y in x:
              if "[no-automatically-extract]" in y:
                  continue
              param_type = y["inner_type"][0]
              name = y["name"][0]
              checks = []
              if "check" in y:
                  checks = y["check"]
              tmp = set_one_var_from_string(name, param_type, checks)
              str_to_write += tmp
      # tails
      str_to_write = f"{str_to_write.strip()}\n}}\n\n"
      str_to_write += (
          "std::string Config::SaveMembersToString() const {\n"
      )
      str_to_write += "  std::stringstream str_buf;\n"
      for x in infos:
          for y in x:
              if "[no-save]" in y:
                  continue
              param_type = y["inner_type"][0]
              name = y["name"][0]
              if "vector" in param_type:
                  if "int8" in param_type:
                      str_to_write += f'  str_buf << "[{name}: " << Common::Join(Common::ArrayCast<int8_t, int>({name}), ",") << "]\\n";\n'
                  else:
                      str_to_write += f'  str_buf << "[{name}: " << Common::Join({name}, ",") << "]\\n";\n'
              else:
                  str_to_write += (
                      f'  str_buf << "[{name}: " << {name} << "]\\n";\n'
                  )
      # tails
      str_to_write += "  return str_buf.str();\n"
      str_to_write += "}\n\n"
  
      str_to_write += """const std::unordered_map<std::string, std::vector<std::string>>& Config::parameter2aliases() {
    static std::unordered_map<std::string, std::vector<std::string>> map({"""
      for name in names:
          str_to_write += '\n    {"' + name + '", '
          if names_with_aliases[name]:
              str_to_write += (
                  '{"' + '", "'.join(names_with_aliases[name]) + '"}},'
              )
          else:
              str_to_write += "{}},"
      str_to_write += """
    });
    return map;
  }
  
  """
      str_to_write += """const std::unordered_map<std::string, std::string>& Config::ParameterTypes() {
    static std::unordered_map<std::string, std::string> map({"""
      int_t_pat = re.compile(r"int\d+_t")
      # the following are stored as comma separated strings but are arrays in the wrappers
      overrides = {
          "categorical_feature": "vector<int>",
          "ignore_column": "vector<int>",
          "interaction_constraints": "vector<vector<int>>",
      }
      for x in infos:
          for y in x:
              name = y["name"][0]
              if name == "task":
                  continue
              if name in overrides:
                  param_type = overrides[name]
              else:
                  param_type = int_t_pat.sub(
                      "int", y["inner_type"][0]
                  ).replace("std::", "")
              str_to_write += (
                  '\n    {"' + name + '", "' + param_type + '"},'
              )
      str_to_write += """
    });
    return map;
  }
  
  """
  
      str_to_write += "}  // namespace LightGBM\n"
      with open(config_out_cpp, "w") as config_out_cpp_file:
          config_out_cpp_file.write(str_to_write)
  
      return keys, infos
  
file_path: LightGBM/helpers/parameter_generator.py
imports: import re
  from collections import defaultdict
  from pathlib import Path
  from typing import Dict, List, Tuple
label_desc: Use image node_id 7 for calling a global function with example usage: gen_parameter_code(config_hpp, config_out_cpp) and returns: keys,  infos