class_docstr: Replacer class for replacing HLO instructions by FileCheck captures.
docstr: Replaces all HLO instruction names by captured FileCheck variables.
  
  Works only for instruction definitions preceded by "CHECK-XXX: " directives.
  
  Args:
    line: One of test lines.
  
  Returns:
    A line with replacements applied.
code: def replace_instruction_names_for_line(self, line: str) -> str:
      """Replaces all HLO instruction names by captured FileCheck variables.
  
      Works only for instruction definitions preceded by "CHECK-XXX: " directives.
  
      Args:
        line: One of test lines.
  
      Returns:
        A line with replacements applied.
      """
      if not self._check_instruction_matcher.match(line):
          # Reset internal storage non-matching lines
          self._counter = -1
          self._replacement_cache = {}
          return line
  
      return re.sub(self._instr_name_matcher, self._replacer, line)
  
file_path: tensorflow/third_party/xla/xla/service/generate_test_hlo_checks.py
imports: import re
  import shutil
  import sys
  import tempfile
  from typing import Dict
label_desc: Use image node_id 2 for calling the FileCheckVarReplacer obj's underlying member method code with example usage: obj.replace_instruction_names_for_line(line) and returns: re, line