(project_dir: str, config: dict,
                             key_path: List[Union[str, int]])
join project dir on a path
join project dir on a path
join project dir on a path
def config_join_project_path(project_dir: str, config: dict,
                             key_path: List[Union[str, int]]):
  """join project dir on a path"""
  d = config
  try:
    for k in key_path[:-1]:
      d = d[k]
    original_path = d[key_path[-1]]
  except KeyError as e:
    logging.warning(f"key_path: {key_path} not found!")
    raise KeyError(repr(e))
  if isinstance(original_path, list):
    d[key_path[-1]] = [os.path.join(project_dir, p) for p in original_path]
  elif isinstance(original_path, str):
    d[key_path[-1]] = os.path.join(project_dir, original_path)
  else:
    logging.warning(f"key_path: {key_path} error.")
    raise TypeError("path is not str or list!")
def config_join_project_path ( project_dir : str , config : dict , key_path : List [ Union [ str , int ] ] ) : d = config try : for k in key_path [ : - 1 ] : d = d [ k ] original_path = d [ key_path [ - 1 ] ] except KeyError as e : logging . warning ( f"key_path: {key_path} not found!" ) raise KeyError ( repr ( e ) ) if isinstance ( original_path , list ) : d [ key_path [ - 1 ] ] = [ os . path . join ( project_dir , p ) for p in original_path ] elif isinstance ( original_path , str ) : d [ key_path [ - 1 ] ] = os . path . join ( project_dir , original_path ) else : logging . warning ( f"key_path: {key_path} error." ) raise TypeError ( "path is not str or list!" )