original_docstring: collect move all links in config to top
  
          only do in the top level of config, collect all level links and return the links with level
  
          Args:
              config: 
                  >>> {
                  >>>     "arg1": {
                  >>>         "arg11": 2
                  >>>         "arg12": 3
                  >>>         "_link": {"arg11": "arg12"}
                  >>>     }
                  >>> }
              all_level_links: TODO
              level: TODO
  
          Returns: 
              >>> {
              >>>     "arg1": {
              >>>         "arg11": 2
              >>>         "arg12": 3
              >>>     }
              >>>     "_link": {"arg1.arg11": "arg1.arg12"}
              >>> }
  
          
docstring: collect move all links in config to top
  only do in the top level of config, collect all level links and return the links with level
docstring_tokens: collect move all links in config to top only do in the top level of config collect all level links and return the links with level
code: def collect_link(cls, config, trace: List=None, all_level_links: Dict=None, level=0):
          """collect move all links in config to top
  
          only do in the top level of config, collect all level links and return the links with level
  
          Args:
              config: 
                  >>> {
                  >>>     "arg1": {
                  >>>         "arg11": 2
                  >>>         "arg12": 3
                  >>>         "_link": {"arg11": "arg12"}
                  >>>     }
                  >>> }
              all_level_links: TODO
              level: TODO
  
          Returns: 
              >>> {
              >>>     "arg1": {
              >>>         "arg11": 2
              >>>         "arg12": 3
              >>>     }
              >>>     "_link": {"arg1.arg11": "arg1.arg12"}
              >>> }
  
          """
          if not trace:
              trace = []
          if not all_level_links:
              all_level_links = {}
              
          if level not in all_level_links:
              all_level_links[level] = {}
          trace_str = ".".join(trace)
          if trace_str:
              # except the top level, all add the '.' suffix
              trace_str = trace_str + '.'
          def add_trace(origin_link: Dict)->Dict:
              """add the root of the config to current config trace to current level para of links
  
              Args:
                  origin_link: which is not added the trace(root to cur node)
  
              Returns: added trace link
  
              """
              added_trace_link = {}
              for source, target in origin_link.items():
                  if isinstance(target, list):
                      target = [trace_str+t for t in target]
                  else:
                      target = trace_str + target
                  source = trace_str + source
                  added_trace_link[source] = target
              return added_trace_link
  
          if "_link" in config:
              # all_level_links[level] = add_trace(config['_link'])
              all_level_links[level].update(add_trace(config.pop('_link')))
  
          for submodule_name, submodule_config in config.items():
              if isinstance(submodule_config, dict):
                  cls.collect_link(submodule_config, trace + [submodule_name], all_level_links, level+1)
          return all_level_links
code_tokens: def collect_link ( cls , config , trace : List = None , all_level_links : Dict = None , level = 0 ) : if not trace : trace = [ ] if not all_level_links : all_level_links = { } if level not in all_level_links : all_level_links [ level ] = { } trace_str = "." . join ( trace ) if trace_str : trace_str = trace_str + '.' def add_trace ( origin_link : Dict ) -> Dict : """add the root of the config to current config trace to current level para of links
  
              Args:
                  origin_link: which is not added the trace(root to cur node)
  
              Returns: added trace link
  
              """ added_trace_link = { } for source , target in origin_link . items ( ) : if isinstance ( target , list ) : target = [ trace_str + t for t in target ] else : target = trace_str + target source = trace_str + source added_trace_link [ source ] = target return added_trace_link if "_link" in config : all_level_links [ level ] . update ( add_trace ( config . pop ( '_link' ) ) ) for submodule_name , submodule_config in config . items ( ) : if isinstance ( submodule_config , dict ) : cls . collect_link ( submodule_config , trace + [ submodule_name ] , all_level_links , level + 1 ) return all_level_links
short_docstring: collect move all links in config to top
  only do in the top level of config, collect all level links and return the links with level
short_docstring_tokens: collect move all links in config to top only do in the top level of config collect all level links and return the links with level
comment: """collect move all links in config to top
  
          only do in the top level of config, collect all level links and return the links with level
  
          Args:
              config: 
                  >>> {
                  >>>     "arg1": {
                  >>>         "arg11": 2
                  >>>         "arg12": 3
                  >>>         "_link": {"arg11": "arg12"}
                  >>>     }
                  >>> }
              all_level_links: TODO
              level: TODO
  
          Returns: 
              >>> {
              >>>     "arg1": {
              >>>         "arg11": 2
              >>>         "arg12": 3
              >>>     }
              >>>     "_link": {"arg1.arg11": "arg1.arg12"}
              >>> }
  
          """$SEP$# except the top level, all add the '.' suffix$SEP$"""add the root of the config to current config trace to current level para of links
  
              Args:
                  origin_link: which is not added the trace(root to cur node)
  
              Returns: added trace link
  
              """$SEP$# all_level_links[level] = add_trace(config['_link'])