code: def main(unused_argv):
      """Dump stats about all the actions that are in use in a set of replays."""
      run_config = run_configs.get()
  
      if not gfile.Exists(FLAGS.replays):
          sys.exit("{} doesn't exist.".format(FLAGS.replays))
  
      stats_queue = multiprocessing.Queue()
      stats_thread = threading.Thread(
          target=stats_printer, args=(stats_queue,)
      )
      try:
          # For some reason buffering everything into a JoinableQueue makes the
          # program not exit, so save it into a list then slowly fill it into the
          # queue in a separate thread. Grab the list synchronously so we know there
          # is work in the queue before the SC2 processes actually run, otherwise
          # The replay_queue.join below succeeds without doing any work, and exits.
          print("Getting replay list:", FLAGS.replays)
          replay_list = sorted(run_config.replay_paths(FLAGS.replays))
          print(len(replay_list), "replays found.")
          if not replay_list:
              return
  
          if not FLAGS["sc2_version"].present:  # ie not set explicitly.
              version = replay.get_replay_version(
                  run_config.replay_data(replay_list[0])
              )
              run_config = run_configs.get(version=version)
              print("Assuming version:", version.game_version)
  
          print()
  
          stats_thread.start()
          replay_queue = multiprocessing.JoinableQueue(
              FLAGS.parallel * 10
          )
          replay_queue_thread = threading.Thread(
              target=replay_queue_filler,
              args=(replay_queue, replay_list),
          )
          replay_queue_thread.daemon = True
          replay_queue_thread.start()
  
          for i in range(min(len(replay_list), FLAGS.parallel)):
              p = ReplayProcessor(
                  i, run_config, replay_queue, stats_queue
              )
              p.daemon = True
              p.start()
              time.sleep(
                  1
              )  # Stagger startups, otherwise they seem to conflict somehow
  
          replay_queue.join()  # Wait for the queue to empty.
      except KeyboardInterrupt:
          print("Caught KeyboardInterrupt, exiting.")
      finally:
          stats_queue.put(
              None
          )  # Tell the stats_thread to print and exit.
          if stats_thread.is_alive():
              stats_thread.join()
  
imports: import collections
  import multiprocessing
  import os
  import queue
  import signal
  import sys
  import threading
  import time
  from absl import app
  from absl import flags
  from pysc2 import run_configs
  from pysc2.lib import features
  from pysc2.lib import point
  from pysc2.lib import protocol
  from pysc2.lib import remote_controller
  from pysc2.lib import replay
  from pysc2.lib import static_data
  from pysc2.lib import gfile
  from s2clientprotocol import common_pb2
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: main(unused_argv) without return types