code: def main(argv: list[str] | None = None) -> None:
      args = parse_args(argv)
      if not TOKEN:
          raise RuntimeError("Failed to find a GitHub Token")
  
      # Note: we drop **all** tests which did not have at least <nfails> failures.
      # This is because, as nice as a block of green tests can be, there are
      # far too many tests to visualize at once, so we only want to look at
      # flaky tests. If the test suite has been doing well, this chart should
      # dwindle to nothing!
      dfs = list(
          download_and_parse_artifacts(
              repo=args.repo,
              branch=args.branch,
              events=args.events,
              max_days=args.max_days,
              max_runs=args.max_runs,
          )
      )
      total = pandas.concat(dfs, axis=0)
      # Reduce the size of the DF since the entire thing is encoded in the vega spec
      required_columns = [
          "test",
          "date",
          "suite",
          "file",
          "html_url",
          "status",
          "message",
      ]
      total = total[required_columns]
      grouped = (
          total.groupby([total.file, total.test])
          .filter(lambda g: (g.status == "x").sum() >= args.nfails)
          .reset_index()
          .assign(test=lambda df: df.file + "." + df.test)
          .groupby("test")
      )
      overall = {
          name: grouped.get_group(name) for name in grouped.groups
      }
  
      # Get all of the workflow run timestamps that we wound up with, which we can use
      # below to align the different groups.
      times = set()
      for df in overall.values():
          times.update(df.date.unique())
  
      print("Making chart...")
      altair.data_transformers.disable_max_rows()
  
      jobs = []
      with ProcessPoolExecutor() as executor:
          for name, df in overall.items():
              # Don't show this suite if it has passed all tests recently.
              if not len(df):
                  continue
              jobs.append(executor.submit(make_chart, name, df, times))
          charts = [job.result() for job in jobs]
  
      # Concat the sub-charts and output to file
      chart = (
          altair.vconcat(*charts)
          .properties(
              title={
                  "text": [f"{args.repo} {args.title}"],
                  "subtitle": [
                      " ".join(argv if argv is not None else sys.argv)
                  ],
              }
          )
          .configure_axis(labelLimit=1000)  # test names are long
          .configure_title(
              anchor="start",
              subtitleFont="monospace",
          )
          .resolve_scale(x="shared")  # enforce aligned x axes
      )
  
      altair_saver.save(
          chart,
          args.output,
          embed_options={
              "renderer": "svg",  # Makes the text searchable
              "loader": {
                  "target": "_blank"
              },  # Open hrefs in a new window
          },
      )
  
imports: from __future__ import annotations
  import argparse
  import contextlib
  import html
  import io
  import os
  import re
  import shelve
  import sys
  import zipfile
  from collections.abc import Iterable, Iterator
  from concurrent.futures import ProcessPoolExecutor
  from typing import Any, cast
  import altair
  import altair_saver
  import junitparser
  import pandas
  import requests
  from requests.adapters import HTTPAdapter
  from urllib3.util.retry import Retry
label_desc: Use image node_id 13 for calling a global function with example usage: main(argv) without return types