class_docstr: Standalone class that applies Instruction rewrite/filtering rules.
  
  This significantly simplifies subsequent parsing by injecting
  synthetic POLARS_EXPRESSION ops into the Instruction stream for
  easy identification/translation and separates the parsing logic
  from the identification of expression translation opportunities.
class_docstr_tok: ["Standalone","class","that","applies","Instruction","rewrite\/filtering","rules",".","This","significantly","simplifies","subsequent","parsing","by","injecting","synthetic","POLARS_EXPRESSION","ops","into","the","Instruction","stream","for","easy","identification\/translation","and","separates","the","parsing","logic","from","the","identification","of","expression","translation","opportunities","."]
docstr: Replace python method calls with synthetic POLARS_EXPRESSION op.
code: def _rewrite_methods(
      self, idx: int, updated_instructions: list[Instruction]
  ) -> int:
      """Replace python method calls with synthetic POLARS_EXPRESSION op."""
      if matching_instructions := self._matches(
          idx,
          opnames=[
              OpNames.LOAD_ATTR if _MIN_PY312 else {"LOAD_METHOD"},
              OpNames.CALL,
          ],
          argvals=[_PYTHON_METHODS_MAP],
      ):
          inst = matching_instructions[0]
          expr_name = _PYTHON_METHODS_MAP[inst.argval]
          synthetic_call = inst._replace(
              opname="POLARS_EXPRESSION",
              argval=expr_name,
              argrepr=expr_name,
          )
          updated_instructions.append(synthetic_call)
  
      return len(matching_instructions)
  
imports: from __future__ import annotations
  import datetime
  import dis
  import inspect
  import re
  import sys
  import warnings
  from bisect import bisect_left
  from collections import defaultdict
  from dis import get_instructions
  from inspect import signature
  from itertools import count, zip_longest
  from pathlib import Path
  from typing import TYPE_CHECKING, AbstractSet, Any, Callable, ClassVar, Iterator, Literal, NamedTuple, Union
label_desc: Use image node_id 9 for calling the RewrittenInstructions obj's underlying member method code with example usage: obj._rewrite_methods(idx, updated_instructions) and returns: len