code: def main():
      # Setup logging
      logging.basicConfig()
      logging.getLogger().setLevel(logging.INFO)
  
      # Setup external symlink if necessary so headers can be found in include paths
      if not (external := _XLA_SRC_ROOT / "external").exists():
          logging.info(
              "Symlinking `xla/bazel-xla/external` to `xla/external`"
          )
          external.symlink_to(_XLA_SRC_ROOT / "bazel-xla" / "external")
  
      logging.info("Reading `bazel aquery` output from stdin...")
      parsed_aquery_output = json.loads(sys.stdin.read())
  
      commands = extract_compile_commands(parsed_aquery_output)
  
      with (_XLA_SRC_ROOT / "compile_commands.json").open("w") as f:
          json.dump(
              [
                  command.to_dumpable_json(directory=str(_XLA_SRC_ROOT))
                  for command in commands
              ],
              f,
          )
  
file_path: tensorflow-upstream/third_party/xla/build_tools/lint/generate_compile_commands.py
imports: import dataclasses
  import json
  import logging
  import pathlib
  import sys
  from typing import Any
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types