code: def parse_args():
      argparser = argparse.ArgumentParser(
          "Runs clang-format on a project"
      )
      argparser.add_argument(
          "-dstdir",
          type=str,
          default=None,
          help="Directory to store the temporary outputs of"
          " clang-format. If nothing is passed for this, then"
          " a temporary dir will be created using `mkdtemp`",
      )
      argparser.add_argument(
          "-exe",
          type=str,
          default="clang-format",
          help="Path to clang-format exe",
      )
      argparser.add_argument(
          "-inplace",
          default=False,
          action="store_true",
          help="Replace the source files itself.",
      )
      argparser.add_argument(
          "-regex",
          type=str,
          default=r"[.](cu|cuh|h|hpp|cpp|inl)$",
          help="Regex string to filter in sources",
      )
      argparser.add_argument(
          "-ignore",
          type=str,
          default=r"cannylab/bh[.]cu$",
          help="Regex used to ignore files from matched list",
      )
      argparser.add_argument(
          "-v",
          dest="verbose",
          action="store_true",
          help="Print verbose messages",
      )
      argparser.add_argument(
          "dirs",
          type=str,
          nargs="*",
          help="List of dirs where to find sources",
      )
      args = argparser.parse_args()
      args.regex_compiled = re.compile(args.regex)
      args.ignore_compiled = re.compile(args.ignore)
      if args.dstdir is None:
          args.dstdir = tempfile.mkdtemp()
      ret = subprocess.check_output(
          "%s --version" % args.exe, shell=True
      )
      ret = ret.decode("utf-8")
      version = VERSION_REGEX.match(ret)
      if version is None:
          raise Exception("Failed to figure out clang-format version!")
      version = version.group(1)
      if version != EXPECTED_VERSION:
          raise Exception(
              "clang-format exe must be v%s found '%s'"
              % (EXPECTED_VERSION, version)
          )
      if len(args.dirs) == 0:
          args.dirs = DEFAULT_DIRS
      return args
  
file_path: cusignal/cpp/scripts/run-clang-format.py
imports: from __future__ import print_function
  import argparse
  import os
  import re
  import subprocess
  import sys
  import tempfile
label_desc: Use image node_id 1 for calling a global function with example usage: parse_args() and returns: args