code: def main() -> int:
      total_count_changes = 0
      matches = [re.compile(spec.regexp) for spec in REPLACEMENTS]
      for file_string in sys.argv:
          count_changes = 0
          path = Path(file_string)
          text = path.read_text()
          for match, spec in zip(matches, REPLACEMENTS):
              text, new_count_changes = match.subn(
                  spec.replacement, text
              )
              if new_count_changes:
                  console.print(
                      f"[yellow] Performed {new_count_changes} replacements of {spec.description}[/]: {path}"
                  )
              count_changes += new_count_changes
          if count_changes:
              path.write_text(text)
          total_count_changes += count_changes
      return 1 if total_count_changes else 0
  
file_path: airflow/scripts/ci/pre_commit/pre_commit_replace_bad_characters.py
imports: from __future__ import annotations
  import re
  import sys
  from pathlib import Path
  from typing import NamedTuple
  from rich.console import Console
label_desc: Use image node_id 1 for calling a global function with example usage: main() and returns: unknown