class_docstr: A class to refactor *get_image_uri() method.
class_docstr_tok: ["A","class","to","refactor","*","get_image_uri","(",")","method","."]
docstr: Modifies the ``ast.Call`` node to call ``image_uris.retrieve`` instead.
  
  And also switch the first two parameters from (region, repo) to (framework, region).
  
  Args:
      node (ast.Call): a node that represents a *image_uris.retrieve call.
docstr_tok: ["Modifies","the","``","ast.Call","``","node","to","call","``","image_uris.retrieve","``","instead",".","And","also","switch","the","first","two","parameters","from","(","region",",","repo",")","to","(","framework",",","region",")",".","Args",":","node","(","ast.Call",")",":","a","node","that","represents","a","*","image_uris.retrieve","call","."]
code: def modify_node(self, node):
      """Modifies the ``ast.Call`` node to call ``image_uris.retrieve`` instead.
  
      And also switch the first two parameters from (region, repo) to (framework, region).
  
      Args:
          node (ast.Call): a node that represents a *image_uris.retrieve call.
      """
      original_args = [None] * 3
      for kw in node.keywords:
          if kw.arg == "repo_name":
              original_args[0] = ast.Str(kw.value.s)
          elif kw.arg == "repo_region":
              original_args[1] = ast.Str(kw.value.s)
          elif kw.arg == "repo_version":
              original_args[2] = ast.Str(kw.value.s)
  
      if len(node.args) > 0:
          original_args[1] = ast.Str(node.args[0].s)
      if len(node.args) > 1:
          original_args[0] = ast.Str(node.args[1].s)
      if len(node.args) > 2:
          original_args[2] = ast.Str(node.args[2].s)
  
      args = []
      for arg in original_args:
          if arg:
              args.append(arg)
  
      func = node.func
      has_sagemaker = False
      while hasattr(func, "value"):
          if hasattr(func.value, "id") and func.value.id == "sagemaker":
              has_sagemaker = True
              break
          func = func.value
  
      if has_sagemaker:
          node.func = ast.Attribute(
              value=ast.Attribute(
                  attr="image_uris", value=ast.Name(id="sagemaker")
              ),
              attr="retrieve",
          )
      else:
          node.func = ast.Attribute(
              value=ast.Name(id="image_uris"), attr="retrieve"
          )
      node.args = args
      node.keywords = []
      return node
  
file_path: sagemaker-python-sdk/src/sagemaker/cli/compatibility/v2/modifiers/image_uris.py
imports: from __future__ import absolute_import
  import ast
  from sagemaker.cli.compatibility.v2.modifiers import matching
  from sagemaker.cli.compatibility.v2.modifiers.modifier import Modifier
label_desc: Use image node_id 2 for calling the ImageURIRetrieveRefactor obj's underlying member method code with example usage: obj.modify_node(node) and returns: node