(field_descriptor)
return EncodeField
Encoder for extensions of MessageSet.

  Maps always have a wire format like this:
    message MapEntry {
      key_type key = 1;
      value_type value = 2;
    }
    repeated MapEntry map = N;
Encoder for extensions of MessageSet.
Encoder for extensions of MessageSet .
def MapEncoder(field_descriptor):
  """Encoder for extensions of MessageSet.

  Maps always have a wire format like this:
    message MapEntry {
      key_type key = 1;
      value_type value = 2;
    }
    repeated MapEntry map = N;
  """
  # Can't look at field_descriptor.message_type._concrete_class because it may
  # not have been initialized yet.
  message_type = field_descriptor.message_type
  encode_message = MessageEncoder(field_descriptor.number, False, False)

  def EncodeField(write, value):
    for key in value:
      entry_msg = message_type._concrete_class(key=key, value=value[key])
      encode_message(write, entry_msg)

  return EncodeField
def MapEncoder ( field_descriptor ) : # Can't look at field_descriptor.message_type._concrete_class because it may # not have been initialized yet. message_type = field_descriptor . message_type encode_message = MessageEncoder ( field_descriptor . number , False , False ) def EncodeField ( write , value ) : for key in value : entry_msg = message_type . _concrete_class ( key = key , value = value [ key ] ) encode_message ( write , entry_msg ) return EncodeField