code: def main():
      parser = argparse.ArgumentParser()
      parser.add_argument(
          "-s",
          "--sources",
          nargs="?",
          const="src",
          help="write sources to directory (relative to output directory)",
      )
      parser.add_argument(
          "-t",
          "--targets",
          type=int,
          default=1500,
          help="number of targets (default: 1500)",
      )
      parser.add_argument(
          "-S", "--seed", type=int, help="random seed", default=12345
      )
      parser.add_argument("outdir", help="output directory")
      args = parser.parse_args()
      root_dir = args.outdir
  
      random.seed(args.seed)
  
      do_write_sources = args.sources is not None
      src_dir = args.sources if do_write_sources else "src"
  
      targets = random_targets(args.targets, src_dir)
      for target in targets:
          with FileWriter(
              os.path.join(root_dir, target.ninja_file_path)
          ) as n:
              write_target_ninja(n, target, src_dir)
  
          if do_write_sources:
              write_sources(target, root_dir)
  
      with FileWriter(
          os.path.join(root_dir, "build.ninja")
      ) as master_ninja:
          master_ninja.width = 120
          write_master_ninja(master_ninja, targets)
  
imports: import argparse
  import contextlib
  import os
  import random
  import sys
  import ninja_syntax
label_desc: Use image node_id 8 for calling a global function with example usage: main() without return types