class_docstr: Utility class to resolve Placeholder expressions.
  
  Placeholder expression is defined as a proto structure
  placeholder_pb2.PlaceholderExpression. It can be resolved with
  ResolutionContext to a concrete value.
class_docstr_tok: ["Utility","class","to","resolve","Placeholder","expressions",".","Placeholder","expression","is","defined","as","a","proto","structure","placeholder_pb2.PlaceholderExpression",".","It","can","be","resolved","with","ResolutionContext","to","a","concrete","value","."]
docstr: Evaluates the make proto operator.
code: def _resolve_make_proto_operator(
      self, op: placeholder_pb2.MakeProtoOperator
  ) -> message.Message:
      """Evaluates the make proto operator."""
      pool = proto_utils.get_pool_with_descriptors(op.file_descriptors)
      # Start with the base proto.
      result = proto_utils.unpack_proto_any(op.base, pool)
      # Then pile all the fields on top.
      for key, value in op.fields.items():
          descriptor = result.DESCRIPTOR.fields_by_name[key]
          field_name = f"{result.DESCRIPTOR.full_name}.{key}"
          # First resolve the placeholder value of the field.
          try:
              value = self.resolve(value)
          except NullDereferenceError:
              value = None
          except Exception as e:
              raise ValueError(
                  f"Failed to resolve field {field_name}"
              ) from e
  
          # Drop fields that evaluate to None.
          if value is None:
              if (
                  descriptor.label
                  == descriptor_lib.FieldDescriptor.LABEL_REQUIRED
              ):
                  raise ValueError(
                      f"Placeholder for required field {field_name} resolved to None."
                  )
              continue
  
          # Then write the resolved value into the output proto.
          if (  # If it's a map<> field.
              descriptor.message_type
              and descriptor.message_type.has_options
              and descriptor.message_type.GetOptions().map_entry
          ):
              if not isinstance(value, dict):
                  raise ValueError(
                      f"Expected dict value for field {field_name}, but the "
                      f"placeholder resolved to {value!r}"
                  )
              out_dict = getattr(result, key)
              for k, v in value.items():
                  if isinstance(v, message.Message):
                      self._assign_proto_message(out_dict[k], v)
                  else:
                      out_dict[k] = v
          elif (
              descriptor.label
              == descriptor_lib.FieldDescriptor.LABEL_REPEATED
          ):
              if not isinstance(value, list):
                  raise ValueError(
                      f"Expected list value for field {field_name}, but the placeholder"
                      f" resolved to {value!r}"
                  )
              out_list = getattr(result, key)
              for item in value:
                  if item is not None:
                      if isinstance(item, message.Message):
                          self._assign_proto_message(
                              out_list.add(), item
                          )
                      else:
                          out_list.append(item)
          elif (
              descriptor.type
              == descriptor_lib.FieldDescriptor.TYPE_MESSAGE
          ):
              self._assign_proto_message(getattr(result, key), value)
          elif (
              descriptor.type
              == descriptor_lib.FieldDescriptor.TYPE_ENUM
          ):
              if isinstance(value, str):
                  value = descriptor.enum_type.values_by_name[
                      value
                  ].number
              setattr(result, key, value)
          else:
              setattr(result, key, value)
  
      return result
  
imports: import base64
  import enum
  import functools
  import os
  import re
  from typing import Any, Callable, Dict, List, Set, Union, cast
  from absl import logging
  import attr
  from tfx.dsl.io import fileio
  from tfx.orchestration.portable import data_types
  from tfx.proto.orchestration import placeholder_pb2
  from tfx.types import artifact
  from tfx.types import artifact_utils
  from tfx.types import value_artifact
  from tfx.utils import json_utils
  from tfx.utils import proto_utils
  from google.protobuf import any_pb2
  from google.protobuf import descriptor
  from google.protobuf import json_format
  from google.protobuf import message
  from google.protobuf import text_format
label_desc: Use image node_id 16 for calling the _ExpressionResolver obj's underlying member method code with example usage: obj._resolve_make_proto_operator(op) and returns: result