code: def get_ratings_for_tests(file: Union[str, Path]) -> Dict[str, float]:
      path = REPO_ROOT / file
      if not os.path.exists(path):
          print(f"could not find path {path}")
          return {}
      with open(path) as f:
          test_file_ratings = cast(
              Dict[str, Dict[str, float]], json.load(f)
          )
      try:
          changed_files = query_changed_files()
      except Exception as e:
          warn(f"Can't query changed test files due to {e}")
          return {}
      ratings: Dict[str, float] = defaultdict(float)
      for file in changed_files:
          for test_file, score in test_file_ratings.get(
              file, {}
          ).items():
              ratings[test_file] += score
      return ratings
  
file_path: pytorch/tools/testing/target_determination/heuristics/utils.py
imports: import json
  import os
  import subprocess
  from collections import defaultdict
  from pathlib import Path
  from typing import cast, Dict, List, Set, Union
  from warnings import warn
label_desc: Use image node_id 4 for calling a global function with example usage: get_ratings_for_tests(file) and returns: ratings, dict, dict