code: def create_compile_commands(self):
      def load(filename):
          with open(filename) as f:
              return json.load(f)
  
      ninja_files = glob.glob("build/*compile_commands.json")
      cmake_files = glob.glob("torch/lib/build/*/compile_commands.json")
      all_commands = [
          entry for f in ninja_files + cmake_files for entry in load(f)
      ]
  
      # cquery does not like c++ compiles that start with gcc.
      # It forgets to include the c++ header directories.
      # We can work around this by replacing the gcc calls that python
      # setup.py generates with g++ calls instead
      for command in all_commands:
          if command["command"].startswith("gcc "):
              command["command"] = "g++ " + command["command"][4:]
  
      new_contents = json.dumps(all_commands, indent=2)
      contents = ""
      if os.path.exists("compile_commands.json"):
          with open("compile_commands.json") as f:
              contents = f.read()
      if contents != new_contents:
          with open("compile_commands.json", "w") as f:
              f.write(new_contents)
  
imports: import sys
  import platform
  import filecmp
  import glob
  import importlib
  import json
  import os
  import shutil
  import subprocess
  import sysconfig
  import time
  from collections import defaultdict
  import setuptools.command.build_ext
  import setuptools.command.install
  import setuptools.command.sdist
  from setuptools import Extension, find_packages, setup
  from setuptools.dist import Distribution
  from tools.build_pytorch_libs import build_caffe2
  from tools.generate_torch_version import get_torch_version
  from tools.setup_helpers.cmake import CMake
  from tools.setup_helpers.env import build_type, IS_DARWIN, IS_LINUX, IS_WINDOWS
label_desc: Use image node_id 5 for calling the build_ext obj's underlying member method code with example usage: obj.create_compile_commands() and returns: json