class_docstr: An ast transformer, to check and replace the python ops 'not/is/is not/in/not in' to functions in 'operator' module.
class_docstr_tok: ["An","ast","transformer",",","to","check","and","replace","the","python","ops","'not\/is\/is","not\/in\/not","in","'","to","functions","in","'operator","'","module","."]
code: def visit_Compare(self, node: ast.Compare):
      should_replace = False
      for op in node.ops:
          if _orig_type(op) in (ast.Is, ast.IsNot, ast.In, ast.NotIn):
              should_replace = True
              break
      if should_replace:
          if _orig_len(node.ops) != 1:
              raise RuntimeError(
                  'not supported in "{} cmp_op {} cmp_op {}" when cmp_op contains "is/is not/in/not in"'
              )
          self.is_transformed = True
          func_id = {
              ast.Is: "is_",
              ast.IsNot: "is_not",
              ast.In: "contains",
              ast.NotIn: "contains",
          }[_orig_type(node.ops[0])]
          if _orig_isinstance(node.ops[0], (ast.In, ast.NotIn)):
              args = [node.comparators[0], node.left]
          else:
              args = [node.left, node.comparators[0]]
          ret_node = ast.Call(
              func=ast.Name(id=func_id, ctx=ast.Load()),
              args=args,
              keywords=[],
          )
          if _orig_isinstance(node.ops[0], ast.NotIn):
              ret_node = ast.Call(
                  func=ast.Name(id="not_", ctx=ast.Load()),
                  args=[ret_node],
                  keywords=[],
              )
          return self.generic_visit(ret_node)
      else:
          return self.generic_visit(node)
  
imports: from typing import TYPE_CHECKING
  import ast
  import builtins
  import inspect
  import logging
  import platform
  from textwrap import dedent
  from types import MethodType, FunctionType
  from typing import List, Optional, Callable, Dict
  import torch
  from .utils import _orig_type, _orig_isinstance, _orig_len, _orig_dict, _orig_zip, _orig_tuple
label_desc: Use image node_id 9 for calling the TransformerOp obj's underlying member method code with example usage: obj.visit_Compare(node) and returns: self, self